Skip to content

Commit

Permalink
docs(samples): add example tags to generated samples (#287)
Browse files Browse the repository at this point in the history
* docs(samples): add example tags to generated samples

PiperOrigin-RevId: 408439482

Source-Link: googleapis/googleapis@b9f6184

Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: change node version for sample

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
  • Loading branch information
3 people authored Nov 10, 2021
1 parent b0301ab commit 315dd21
Show file tree
Hide file tree
Showing 19 changed files with 1,158 additions and 1 deletion.
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(name) {
// [START cloudbuild_v1_generated_CloudBuild_ApproveBuild_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the target build.
* For example: "projects/{$project_id}/builds/{$build_id}"
*/
// const name = 'abc123'
/**
* Approval decision and metadata.
*/
// const approvalResult = {}

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callApproveBuild() {
// Construct request
const request = {
name,
};

// Run request
const [operation] = await cloudbuildClient.approveBuild(request);
const [response] = await operation.promise();
console.log(response);
}

callApproveBuild();
// [END cloudbuild_v1_generated_CloudBuild_ApproveBuild_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(projectId, id) {
// [START cloudbuild_v1_generated_CloudBuild_CancelBuild_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The name of the `Build` to cancel.
* Format: `projects/{project}/locations/{location}/builds/{build}`
*/
// const name = 'abc123'
/**
* Required. ID of the project.
*/
// const projectId = 'abc123'
/**
* Required. ID of the build.
*/
// const id = 'abc123'

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callCancelBuild() {
// Construct request
const request = {
projectId,
id,
};

// Run request
const response = await cloudbuildClient.cancelBuild(request);
console.log(response);
}

callCancelBuild();
// [END cloudbuild_v1_generated_CloudBuild_CancelBuild_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,63 @@
// 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(projectId, build) {
// [START cloudbuild_v1_generated_CloudBuild_CreateBuild_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The parent resource where this build will be created.
* Format: `projects/{project}/locations/{location}`
*/
// const parent = 'abc123'
/**
* Required. ID of the project.
*/
// const projectId = 'abc123'
/**
* Required. Build resource to create.
*/
// const build = {}

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callCreateBuild() {
// Construct request
const request = {
projectId,
build,
};

// Run request
const [operation] = await cloudbuildClient.createBuild(request);
const [response] = await operation.promise();
console.log(response);
}

callCreateBuild();
// [END cloudbuild_v1_generated_CloudBuild_CreateBuild_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(projectId, trigger) {
// [START cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The parent resource where this trigger will be created.
* Format: `projects/{project}/locations/{location}`
*/
// const parent = 'abc123'
/**
* Required. ID of the project for which to configure automatic builds.
*/
// const projectId = 'abc123'
/**
* Required. `BuildTrigger` to create.
*/
// const trigger = {}

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callCreateBuildTrigger() {
// Construct request
const request = {
projectId,
trigger,
};

// Run request
const response = await cloudbuildClient.createBuildTrigger(request);
console.log(response);
}

callCreateBuildTrigger();
// [END cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_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,72 @@
// 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, workerPool, workerPoolId) {
// [START cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource where this worker pool will be created.
* Format: `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
/**
* Required. `WorkerPool` resource to create.
*/
// const workerPool = {}
/**
* Required. Immutable. The ID to use for the `WorkerPool`, which will become
* the final component of the resource name.
* This value should be 1-63 characters, and valid characters
* are /[a-z][0-9]-/.
*/
// const workerPoolId = 'abc123'
/**
* If set, validate the request and preview the response, but do not actually
* post it.
*/
// const validateOnly = true

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callCreateWorkerPool() {
// Construct request
const request = {
parent,
workerPool,
workerPoolId,
};

// Run request
const [operation] = await cloudbuildClient.createWorkerPool(request);
const [response] = await operation.promise();
console.log(response);
}

callCreateWorkerPool();
// [END cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_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(projectId, triggerId) {
// [START cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The name of the `Trigger` to delete.
* Format: `projects/{project}/locations/{location}/triggers/{trigger}`
*/
// const name = 'abc123'
/**
* Required. ID of the project that owns the trigger.
*/
// const projectId = 'abc123'
/**
* Required. ID of the `BuildTrigger` to delete.
*/
// const triggerId = 'abc123'

// Imports the Cloudbuild library
const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1;

// Instantiates a client
const cloudbuildClient = new CloudBuildClient();

async function callDeleteBuildTrigger() {
// Construct request
const request = {
projectId,
triggerId,
};

// Run request
const response = await cloudbuildClient.deleteBuildTrigger(request);
console.log(response);
}

callDeleteBuildTrigger();
// [END cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit 315dd21

Please sign in to comment.