-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add auto-generated samples for Node with api short nam…
…e in region tag (#221) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
- Loading branch information
1 parent
53effa4
commit 4c17fbc
Showing
7 changed files
with
305 additions
and
3 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...s/google-monitoring-dashboard/samples/generated/v1/dashboards_service.create_dashboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(parent, dashboard) { | ||
// [START monitoring_v1_generated_DashboardsService_CreateDashboard_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* 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. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The initial dashboard specification. | ||
*/ | ||
// const dashboard = '' | ||
/** | ||
* If set, validate the request and preview the review, but do not actually | ||
* save it. | ||
*/ | ||
// const validateOnly = true | ||
|
||
// Imports the Dashboard library | ||
const {DashboardsServiceClient} = | ||
require('@google-cloud/monitoring-dashboards').v1; | ||
|
||
// Instantiates a client | ||
const dashboardClient = new DashboardsServiceClient(); | ||
|
||
async function createDashboard() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
dashboard, | ||
}; | ||
|
||
// Run request | ||
const response = await dashboardClient.createDashboard(request); | ||
console.log(response); | ||
} | ||
|
||
createDashboard(); | ||
// [END monitoring_v1_generated_DashboardsService_CreateDashboard_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
54 changes: 54 additions & 0 deletions
54
...s/google-monitoring-dashboard/samples/generated/v1/dashboards_service.delete_dashboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START monitoring_v1_generated_DashboardsService_DeleteDashboard_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The resource name of the Dashboard. The format is: | ||
* projects/[PROJECT_ID_OR_NUMBER]/dashboards/[DASHBOARD_ID] | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Dashboard library | ||
const {DashboardsServiceClient} = | ||
require('@google-cloud/monitoring-dashboards').v1; | ||
|
||
// Instantiates a client | ||
const dashboardClient = new DashboardsServiceClient(); | ||
|
||
async function deleteDashboard() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await dashboardClient.deleteDashboard(request); | ||
console.log(response); | ||
} | ||
|
||
deleteDashboard(); | ||
// [END monitoring_v1_generated_DashboardsService_DeleteDashboard_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
56 changes: 56 additions & 0 deletions
56
...ages/google-monitoring-dashboard/samples/generated/v1/dashboards_service.get_dashboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START monitoring_v1_generated_DashboardsService_GetDashboard_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* 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). | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Dashboard library | ||
const {DashboardsServiceClient} = | ||
require('@google-cloud/monitoring-dashboards').v1; | ||
|
||
// Instantiates a client | ||
const dashboardClient = new DashboardsServiceClient(); | ||
|
||
async function getDashboard() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await dashboardClient.getDashboard(request); | ||
console.log(response); | ||
} | ||
|
||
getDashboard(); | ||
// [END monitoring_v1_generated_DashboardsService_GetDashboard_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
67 changes: 67 additions & 0 deletions
67
...es/google-monitoring-dashboard/samples/generated/v1/dashboards_service.list_dashboards.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(parent) { | ||
// [START monitoring_v1_generated_DashboardsService_ListDashboards_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The scope of the dashboards to list. The format is: | ||
* projects/[PROJECT_ID_OR_NUMBER] | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* A positive number that is the maximum number of results to return. | ||
* If unspecified, a default of 1000 is used. | ||
*/ | ||
// const pageSize = 1234 | ||
/** | ||
* If this field is not empty then it must contain the `nextPageToken` value | ||
* returned by a previous call to this method. Using this field causes the | ||
* method to return additional results from the previous method call. | ||
*/ | ||
// const pageToken = 'abc123' | ||
|
||
// Imports the Dashboard library | ||
const {DashboardsServiceClient} = | ||
require('@google-cloud/monitoring-dashboards').v1; | ||
|
||
// Instantiates a client | ||
const dashboardClient = new DashboardsServiceClient(); | ||
|
||
async function listDashboards() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
}; | ||
|
||
// Run request | ||
const iterable = await dashboardClient.listDashboardsAsync(request); | ||
for await (const response of iterable) { | ||
console.log(response); | ||
} | ||
} | ||
|
||
listDashboards(); | ||
// [END monitoring_v1_generated_DashboardsService_ListDashboards_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
58 changes: 58 additions & 0 deletions
58
...s/google-monitoring-dashboard/samples/generated/v1/dashboards_service.update_dashboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(dashboard) { | ||
// [START monitoring_v1_generated_DashboardsService_UpdateDashboard_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The dashboard that will replace the existing dashboard. | ||
*/ | ||
// const dashboard = '' | ||
/** | ||
* If set, validate the request and preview the review, but do not actually | ||
* save it. | ||
*/ | ||
// const validateOnly = true | ||
|
||
// Imports the Dashboard library | ||
const {DashboardsServiceClient} = | ||
require('@google-cloud/monitoring-dashboards').v1; | ||
|
||
// Instantiates a client | ||
const dashboardClient = new DashboardsServiceClient(); | ||
|
||
async function updateDashboard() { | ||
// Construct request | ||
const request = { | ||
dashboard, | ||
}; | ||
|
||
// Run request | ||
const response = await dashboardClient.updateDashboard(request); | ||
console.log(response); | ||
} | ||
|
||
updateDashboard(); | ||
// [END monitoring_v1_generated_DashboardsService_UpdateDashboard_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters