-
Notifications
You must be signed in to change notification settings - Fork 592
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 (#269) - [ ] 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
034b491
commit e23cc23
Showing
13 changed files
with
598 additions
and
5 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
packages/google-cloud-billing-budgets/samples/generated/v1/budget_service.create_budget.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(parent, budget) { | ||
// [START billingbudgets_v1_generated_BudgetService_CreateBudget_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the billing account to create the budget in. Values | ||
* are of the form `billingAccounts/{billingAccountId}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. Budget to create. | ||
*/ | ||
// const budget = '' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = require('@google-cloud/billing-budgets').v1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function createBudget() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
budget, | ||
}; | ||
|
||
// Run request | ||
const response = await budgetsClient.createBudget(request); | ||
console.log(response); | ||
} | ||
|
||
createBudget(); | ||
// [END billingbudgets_v1_generated_BudgetService_CreateBudget_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
53 changes: 53 additions & 0 deletions
53
packages/google-cloud-billing-budgets/samples/generated/v1/budget_service.delete_budget.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,53 @@ | ||
// 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 billingbudgets_v1_generated_BudgetService_DeleteBudget_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Name of the budget to delete. Values are of the form | ||
* `billingAccounts/{billingAccountId}/budgets/{budgetId}`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = require('@google-cloud/billing-budgets').v1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function deleteBudget() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await budgetsClient.deleteBudget(request); | ||
console.log(response); | ||
} | ||
|
||
deleteBudget(); | ||
// [END billingbudgets_v1_generated_BudgetService_DeleteBudget_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
53 changes: 53 additions & 0 deletions
53
packages/google-cloud-billing-budgets/samples/generated/v1/budget_service.get_budget.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,53 @@ | ||
// 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 billingbudgets_v1_generated_BudgetService_GetBudget_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Name of budget to get. Values are of the form | ||
* `billingAccounts/{billingAccountId}/budgets/{budgetId}`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = require('@google-cloud/billing-budgets').v1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function getBudget() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await budgetsClient.getBudget(request); | ||
console.log(response); | ||
} | ||
|
||
getBudget(); | ||
// [END billingbudgets_v1_generated_BudgetService_GetBudget_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
66 changes: 66 additions & 0 deletions
66
packages/google-cloud-billing-budgets/samples/generated/v1/budget_service.list_budgets.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,66 @@ | ||
// 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 billingbudgets_v1_generated_BudgetService_ListBudgets_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Name of billing account to list budgets under. Values | ||
* are of the form `billingAccounts/{billingAccountId}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Optional. The maximum number of budgets to return per page. | ||
* The default and maximum value are 100. | ||
*/ | ||
// const pageSize = 1234 | ||
/** | ||
* Optional. The value returned by the last `ListBudgetsResponse` which | ||
* indicates that this is a continuation of a prior `ListBudgets` call, | ||
* and that the system should return the next page of data. | ||
*/ | ||
// const pageToken = 'abc123' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = require('@google-cloud/billing-budgets').v1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function listBudgets() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
}; | ||
|
||
// Run request | ||
const iterable = await budgetsClient.listBudgetsAsync(request); | ||
for await (const response of iterable) { | ||
console.log(response); | ||
} | ||
} | ||
|
||
listBudgets(); | ||
// [END billingbudgets_v1_generated_BudgetService_ListBudgets_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
62 changes: 62 additions & 0 deletions
62
packages/google-cloud-billing-budgets/samples/generated/v1/budget_service.update_budget.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,62 @@ | ||
// 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(budget) { | ||
// [START billingbudgets_v1_generated_BudgetService_UpdateBudget_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The updated budget object. | ||
* The budget to update is specified by the budget name in the budget. | ||
*/ | ||
// const budget = '' | ||
/** | ||
* Optional. Indicates which fields in the provided budget to update. | ||
* Read-only fields (such as `name`) cannot be changed. If this is not | ||
* provided, then only fields with non-default values from the request are | ||
* updated. See | ||
* https://developers.google.com/protocol-buffers/docs/proto3#default for more | ||
* details about default values. | ||
*/ | ||
// const updateMask = '' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = require('@google-cloud/billing-budgets').v1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function updateBudget() { | ||
// Construct request | ||
const request = { | ||
budget, | ||
}; | ||
|
||
// Run request | ||
const response = await budgetsClient.updateBudget(request); | ||
console.log(response); | ||
} | ||
|
||
updateBudget(); | ||
// [END billingbudgets_v1_generated_BudgetService_UpdateBudget_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
59 changes: 59 additions & 0 deletions
59
...es/google-cloud-billing-budgets/samples/generated/v1beta1/budget_service.create_budget.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,59 @@ | ||
// 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, budget) { | ||
// [START billingbudgets_v1beta1_generated_BudgetService_CreateBudget_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the billing account to create the budget in. Values | ||
* are of the form `billingAccounts/{billingAccountId}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. Budget to create. | ||
*/ | ||
// const budget = '' | ||
|
||
// Imports the Budgets library | ||
const {BudgetServiceClient} = | ||
require('@google-cloud/billing-budgets').v1beta1; | ||
|
||
// Instantiates a client | ||
const budgetsClient = new BudgetServiceClient(); | ||
|
||
async function createBudget() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
budget, | ||
}; | ||
|
||
// Run request | ||
const response = await budgetsClient.createBudget(request); | ||
console.log(response); | ||
} | ||
|
||
createBudget(); | ||
// [END billingbudgets_v1beta1_generated_BudgetService_CreateBudget_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.