From 346a822765c227bf318964469928b6ef274116d7 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:42:28 +0000
Subject: [PATCH] docs(samples): add example tags to generated samples (#229)
- [ ] Regenerate this pull request now.
PiperOrigin-RevId: 408439482
Source-Link: https://github.com/googleapis/googleapis/commit/b9f61843dc80c7c285fc34fd3a40aae55082c2b9
Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
---
.../linkinator.config.json | 2 +-
.../v1/dashboards_service.create_dashboard.js | 6 +-
.../v1/dashboards_service.delete_dashboard.js | 4 +-
.../v1/dashboards_service.get_dashboard.js | 4 +-
.../v1/dashboards_service.list_dashboards.js | 4 +-
.../v1/dashboards_service.update_dashboard.js | 6 +-
.../src/v1/dashboards_service_client.ts | 268 +++++++++---------
7 files changed, 145 insertions(+), 149 deletions(-)
diff --git a/packages/google-monitoring-dashboard/linkinator.config.json b/packages/google-monitoring-dashboard/linkinator.config.json
index 29a223b6db6..0121dfa684f 100644
--- a/packages/google-monitoring-dashboard/linkinator.config.json
+++ b/packages/google-monitoring-dashboard/linkinator.config.json
@@ -6,5 +6,5 @@
"img.shields.io"
],
"silent": true,
- "concurrency": 10
+ "concurrency": 5
}
diff --git a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.create_dashboard.js b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.create_dashboard.js
index 4099e623938..418077b457c 100644
--- a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.create_dashboard.js
+++ b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.create_dashboard.js
@@ -28,7 +28,7 @@ function main(parent, dashboard) {
/**
* Required. The initial dashboard specification.
*/
- // const dashboard = ''
+ // const dashboard = {}
/**
* If set, validate the request and preview the review, but do not actually
* save it.
@@ -42,7 +42,7 @@ function main(parent, dashboard) {
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
- async function createDashboard() {
+ async function callCreateDashboard() {
// Construct request
const request = {
parent,
@@ -54,7 +54,7 @@ function main(parent, dashboard) {
console.log(response);
}
- createDashboard();
+ callCreateDashboard();
// [END monitoring_v1_generated_DashboardsService_CreateDashboard_async]
}
diff --git a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.delete_dashboard.js b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.delete_dashboard.js
index 855c7b5a1eb..b363b758094 100644
--- a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.delete_dashboard.js
+++ b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.delete_dashboard.js
@@ -32,7 +32,7 @@ function main(name) {
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
- async function deleteDashboard() {
+ async function callDeleteDashboard() {
// Construct request
const request = {
name,
@@ -43,7 +43,7 @@ function main(name) {
console.log(response);
}
- deleteDashboard();
+ callDeleteDashboard();
// [END monitoring_v1_generated_DashboardsService_DeleteDashboard_async]
}
diff --git a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.get_dashboard.js b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.get_dashboard.js
index 1b9d2536246..97674ec01fc 100644
--- a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.get_dashboard.js
+++ b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.get_dashboard.js
@@ -34,7 +34,7 @@ function main(name) {
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
- async function getDashboard() {
+ async function callGetDashboard() {
// Construct request
const request = {
name,
@@ -45,7 +45,7 @@ function main(name) {
console.log(response);
}
- getDashboard();
+ callGetDashboard();
// [END monitoring_v1_generated_DashboardsService_GetDashboard_async]
}
diff --git a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.list_dashboards.js b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.list_dashboards.js
index f47bb407f61..4a09d0ffef5 100644
--- a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.list_dashboards.js
+++ b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.list_dashboards.js
@@ -43,7 +43,7 @@ function main(parent) {
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
- async function listDashboards() {
+ async function callListDashboards() {
// Construct request
const request = {
parent,
@@ -56,7 +56,7 @@ function main(parent) {
}
}
- listDashboards();
+ callListDashboards();
// [END monitoring_v1_generated_DashboardsService_ListDashboards_async]
}
diff --git a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.update_dashboard.js b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.update_dashboard.js
index 43f4cc96619..b6815da5d08 100644
--- a/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.update_dashboard.js
+++ b/packages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.update_dashboard.js
@@ -22,7 +22,7 @@ function main(dashboard) {
/**
* Required. The dashboard that will replace the existing dashboard.
*/
- // const dashboard = ''
+ // const dashboard = {}
/**
* If set, validate the request and preview the review, but do not actually
* save it.
@@ -36,7 +36,7 @@ function main(dashboard) {
// Instantiates a client
const dashboardClient = new DashboardsServiceClient();
- async function updateDashboard() {
+ async function callUpdateDashboard() {
// Construct request
const request = {
dashboard,
@@ -47,7 +47,7 @@ function main(dashboard) {
console.log(response);
}
- updateDashboard();
+ callUpdateDashboard();
// [END monitoring_v1_generated_DashboardsService_UpdateDashboard_async]
}
diff --git a/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts b/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts
index d39343d1aab..c4c19f69f9f 100644
--- a/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts
+++ b/packages/google-monitoring-dashboard/src/v1/dashboards_service_client.ts
@@ -330,6 +330,33 @@ export class DashboardsServiceClient {
// -------------------
// -- Service calls --
// -------------------
+ /**
+ * Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
+ * This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.parent
+ * Required. The project on which to execute the request. The format is:
+ *
+ * projects/[PROJECT_ID_OR_NUMBER]
+ *
+ * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name.
+ * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard
+ * Required. The initial dashboard specification.
+ * @param {boolean} request.validateOnly
+ * If set, validate the request and preview the review, but do not actually
+ * save it.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example
include:samples/generated/v1/dashboards_service.create_dashboard.js
+ * region_tag:monitoring_v1_generated_DashboardsService_CreateDashboard_async
+ */
createDashboard(
request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest,
options?: CallOptions
@@ -361,33 +388,6 @@ export class DashboardsServiceClient {
{} | null | undefined
>
): void;
- /**
- * Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](https://cloud.google.com/monitoring/dashboards/api-dashboard).
- * This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](https://cloud.google.com/iam).
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.parent
- * Required. The project on which to execute the request. The format is:
- *
- * projects/[PROJECT_ID_OR_NUMBER]
- *
- * The `[PROJECT_ID_OR_NUMBER]` must match the dashboard resource name.
- * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard
- * Required. The initial dashboard specification.
- * @param {boolean} request.validateOnly
- * If set, validate the request and preview the review, but do not actually
- * save it.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.createDashboard(request);
- */
createDashboard(
request?: protos.google.monitoring.dashboard.v1.ICreateDashboardRequest,
optionsOrCallback?:
@@ -431,6 +431,31 @@ export class DashboardsServiceClient {
this.initialize();
return this.innerApiCalls.createDashboard(request, options, callback);
}
+ /**
+ * Fetches a specific dashboard.
+ *
+ * This method requires the `monitoring.dashboards.get` permission
+ * on the specified dashboard. For more information, see
+ * [Cloud Identity and Access Management](https://cloud.google.com/iam).
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The resource name of the Dashboard. The format is one of:
+ *
+ * - `dashboards/[DASHBOARD_ID]` (for system dashboards)
+ * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]`
+ * (for custom dashboards).
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1/dashboards_service.get_dashboard.js
+ * region_tag:monitoring_v1_generated_DashboardsService_GetDashboard_async
+ */
getDashboard(
request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest,
options?: CallOptions
@@ -462,31 +487,6 @@ export class DashboardsServiceClient {
{} | null | undefined
>
): void;
- /**
- * Fetches a specific dashboard.
- *
- * This method requires the `monitoring.dashboards.get` permission
- * on the specified dashboard. For more information, see
- * [Cloud Identity and Access Management](https://cloud.google.com/iam).
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The resource name of the Dashboard. The format is one of:
- *
- * - `dashboards/[DASHBOARD_ID]` (for system dashboards)
- * - `projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]`
- * (for custom dashboards).
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.getDashboard(request);
- */
getDashboard(
request?: protos.google.monitoring.dashboard.v1.IGetDashboardRequest,
optionsOrCallback?:
@@ -530,6 +530,29 @@ export class DashboardsServiceClient {
this.initialize();
return this.innerApiCalls.getDashboard(request, options, callback);
}
+ /**
+ * Deletes an existing custom dashboard.
+ *
+ * This method requires the `monitoring.dashboards.delete` permission
+ * on the specified dashboard. For more information, see
+ * [Cloud Identity and Access Management](https://cloud.google.com/iam).
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The resource name of the Dashboard. The format is:
+ *
+ * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1/dashboards_service.delete_dashboard.js
+ * region_tag:monitoring_v1_generated_DashboardsService_DeleteDashboard_async
+ */
deleteDashboard(
request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest,
options?: CallOptions
@@ -561,29 +584,6 @@ export class DashboardsServiceClient {
{} | null | undefined
>
): void;
- /**
- * Deletes an existing custom dashboard.
- *
- * This method requires the `monitoring.dashboards.delete` permission
- * on the specified dashboard. For more information, see
- * [Cloud Identity and Access Management](https://cloud.google.com/iam).
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The resource name of the Dashboard. The format is:
- *
- * projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID]
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.deleteDashboard(request);
- */
deleteDashboard(
request?: protos.google.monitoring.dashboard.v1.IDeleteDashboardRequest,
optionsOrCallback?:
@@ -627,6 +627,30 @@ export class DashboardsServiceClient {
this.initialize();
return this.innerApiCalls.deleteDashboard(request, options, callback);
}
+ /**
+ * Replaces an existing custom dashboard with a new definition.
+ *
+ * This method requires the `monitoring.dashboards.update` permission
+ * on the specified dashboard. For more information, see
+ * [Cloud Identity and Access Management](https://cloud.google.com/iam).
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard
+ * Required. The dashboard that will replace the existing dashboard.
+ * @param {boolean} request.validateOnly
+ * If set, validate the request and preview the review, but do not actually
+ * save it.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1/dashboards_service.update_dashboard.js
+ * region_tag:monitoring_v1_generated_DashboardsService_UpdateDashboard_async
+ */
updateDashboard(
request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest,
options?: CallOptions
@@ -658,30 +682,6 @@ export class DashboardsServiceClient {
{} | null | undefined
>
): void;
- /**
- * Replaces an existing custom dashboard with a new definition.
- *
- * This method requires the `monitoring.dashboards.update` permission
- * on the specified dashboard. For more information, see
- * [Cloud Identity and Access Management](https://cloud.google.com/iam).
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.monitoring.dashboard.v1.Dashboard} request.dashboard
- * Required. The dashboard that will replace the existing dashboard.
- * @param {boolean} request.validateOnly
- * If set, validate the request and preview the review, but do not actually
- * save it.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [Dashboard]{@link google.monitoring.dashboard.v1.Dashboard}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.updateDashboard(request);
- */
updateDashboard(
request?: protos.google.monitoring.dashboard.v1.IUpdateDashboardRequest,
optionsOrCallback?:
@@ -726,37 +726,6 @@ export class DashboardsServiceClient {
return this.innerApiCalls.updateDashboard(request, options, callback);
}
- listDashboards(
- request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
- options?: CallOptions
- ): Promise<
- [
- protos.google.monitoring.dashboard.v1.IDashboard[],
- protos.google.monitoring.dashboard.v1.IListDashboardsRequest | null,
- protos.google.monitoring.dashboard.v1.IListDashboardsResponse
- ]
- >;
- listDashboards(
- request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
- options: CallOptions,
- callback: PaginationCallback<
- protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
- | protos.google.monitoring.dashboard.v1.IListDashboardsResponse
- | null
- | undefined,
- protos.google.monitoring.dashboard.v1.IDashboard
- >
- ): void;
- listDashboards(
- request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
- callback: PaginationCallback<
- protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
- | protos.google.monitoring.dashboard.v1.IListDashboardsResponse
- | null
- | undefined,
- protos.google.monitoring.dashboard.v1.IDashboard
- >
- ): void;
/**
* Lists the existing dashboards.
*
@@ -790,6 +759,37 @@ export class DashboardsServiceClient {
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
+ listDashboards(
+ request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
+ options?: CallOptions
+ ): Promise<
+ [
+ protos.google.monitoring.dashboard.v1.IDashboard[],
+ protos.google.monitoring.dashboard.v1.IListDashboardsRequest | null,
+ protos.google.monitoring.dashboard.v1.IListDashboardsResponse
+ ]
+ >;
+ listDashboards(
+ request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
+ options: CallOptions,
+ callback: PaginationCallback<
+ protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
+ | protos.google.monitoring.dashboard.v1.IListDashboardsResponse
+ | null
+ | undefined,
+ protos.google.monitoring.dashboard.v1.IDashboard
+ >
+ ): void;
+ listDashboards(
+ request: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
+ callback: PaginationCallback<
+ protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
+ | protos.google.monitoring.dashboard.v1.IListDashboardsResponse
+ | null
+ | undefined,
+ protos.google.monitoring.dashboard.v1.IDashboard
+ >
+ ): void;
listDashboards(
request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
optionsOrCallback?:
@@ -910,11 +910,8 @@ export class DashboardsServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
- * @example
- * const iterable = client.listDashboardsAsync(request);
- * for await (const response of iterable) {
- * // process response
- * }
+ * @example include:samples/generated/v1/dashboards_service.list_dashboards.js
+ * region_tag:monitoring_v1_generated_DashboardsService_ListDashboards_async
*/
listDashboardsAsync(
request?: protos.google.monitoring.dashboard.v1.IListDashboardsRequest,
@@ -928,7 +925,6 @@ export class DashboardsServiceClient {
gax.routingHeader.fromParams({
parent: request.parent || '',
});
- options = options || {};
const defaultCallSettings = this._defaults['listDashboards'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();