Skip to content

Commit

Permalink
docs(samples): add auto-generated samples for Node with api short nam…
Browse files Browse the repository at this point in the history
…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
gcf-owl-bot[bot] committed Sep 28, 2021
1 parent 034b491 commit e23cc23
Show file tree
Hide file tree
Showing 13 changed files with 598 additions and 5 deletions.
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));
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));
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));
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));
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));
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));
Loading

0 comments on commit e23cc23

Please sign in to comment.