From 9259218851df01d2229608c5de33077ed72ff741 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 24 May 2022 09:59:29 +0000 Subject: [PATCH 1/2] fix: fixes for dynamic routing and streaming descriptors Use gapic-generator-typescript v2.14.5. PiperOrigin-RevId: 450616838 Source-Link: https://github.com/googleapis/googleapis/commit/7a47b72791e0b84d78beca4c2b26bec42ce31572 Source-Link: https://github.com/googleapis/googleapis-gen/commit/42cc6331bae0b99f61b8e01ae15b05211716c4f9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDJjYzYzMzFiYWUwYjk5ZjYxYjhlMDFhZTE1YjA1MjExNzE2YzRmOSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../devtools/cloudbuild/v1/cloudbuild.proto | 2142 +++++++++++ .../generated/v1/cloud_build.approve_build.js | 64 + .../generated/v1/cloud_build.cancel_build.js | 68 + .../generated/v1/cloud_build.create_build.js | 69 + .../v1/cloud_build.create_build_trigger.js | 68 + .../v1/cloud_build.create_worker_pool.js | 78 + .../v1/cloud_build.delete_build_trigger.js | 68 + .../v1/cloud_build.delete_worker_pool.js | 76 + .../generated/v1/cloud_build.get_build.js | 68 + .../v1/cloud_build.get_build_trigger.js | 68 + .../v1/cloud_build.get_worker_pool.js | 59 + .../v1/cloud_build.list_build_triggers.js | 73 + .../generated/v1/cloud_build.list_builds.js | 82 + .../v1/cloud_build.list_worker_pools.js | 71 + .../v1/cloud_build.receive_trigger_webhook.js | 74 + .../generated/v1/cloud_build.retry_build.js | 69 + .../v1/cloud_build.run_build_trigger.js | 73 + .../v1/cloud_build.update_build_trigger.js | 68 + .../v1/cloud_build.update_worker_pool.js | 70 + ...etadata.google.devtools.cloudbuild.v1.json | 899 +++++ owl-bot-staging/v1/src/index.ts | 25 + .../v1/src/v1/cloud_build_client.ts | 2878 +++++++++++++++ .../v1/src/v1/cloud_build_client_config.json | 114 + .../v1/src/v1/cloud_build_proto_list.json | 3 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 215 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_cloud_build_v1.ts | 3244 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 41 files changed, 11211 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_build_client.ts create mode 100644 owl-bot-staging/v1/src/v1/cloud_build_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/cloud_build_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_cloud_build_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..773c8c4 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/cloudbuild', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..1e997be --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..6a8e81f --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/cloudbuild", + "version": "0.1.0", + "description": "Cloudbuild client for Node.js", + "repository": "googleapis/nodejs-cloudbuild", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google cloudbuild", + "cloudbuild", + "cloud build" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto new file mode 100644 index 0000000..3f980c7 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -0,0 +1,2142 @@ +// 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. + +syntax = "proto3"; + +package google.devtools.cloudbuild.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.CloudBuild.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild"; +option java_multiple_files = true; +option java_package = "com.google.cloudbuild.v1"; +option objc_class_prefix = "GCB"; +option ruby_package = "Google::Cloud::Build::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/Secret" + pattern: "projects/{project}/secrets/{secret}" +}; +option (google.api.resource_definition) = { + type: "secretmanager.googleapis.com/SecretVersion" + pattern: "projects/{project}/secrets/{secret}/versions/{version}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Subscription" + pattern: "projects/{project}/subscriptions/{subscription}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Creates and manages builds on Google Cloud Platform. +// +// The main concept used by this API is a `Build`, which describes the location +// of the source to build, how to build the source, and where to store the +// built artifacts, if any. +// +// A user can list previously-requested builds or get builds by their ID to +// determine the status of the build. +service CloudBuild { + option (google.api.default_host) = "cloudbuild.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Starts a build with the specified configuration. + // + // This method returns a long-running `Operation`, which includes the build + // ID. Pass the build ID to `GetBuild` to determine the build status (such as + // `SUCCESS` or `FAILURE`). + rpc CreateBuild(CreateBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds" + body: "build" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*}/builds" + body: "build" + } + }; + option (google.api.method_signature) = "project_id,build"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Returns information about a previously requested build. + // + // The `Build` that is returned includes its status (such as `SUCCESS`, + // `FAILURE`, or `WORKING`), and timing information. + rpc GetBuild(GetBuildRequest) returns (Build) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds/{id}" + additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Lists previously requested builds. + // + // Previously requested builds may still be in-progress, or may have finished + // successfully or unsuccessfully. + rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds" + additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } + }; + option (google.api.method_signature) = "project_id,filter"; + } + + // Cancels a build in progress. + rpc CancelBuild(CancelBuildRequest) returns (Build) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:cancel" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Creates a new build based on the specified build. + // + // This method creates a new build using the original build request, which may + // or may not result in an identical build. + // + // For triggered builds: + // + // * Triggered builds resolve to a precise revision; therefore a retry of a + // triggered build will result in a build that uses the same revision. + // + // For non-triggered builds that specify `RepoSource`: + // + // * If the original build built from the tip of a branch, the retried build + // will build from the tip of that branch, which may not be the same revision + // as the original build. + // * If the original build specified a commit sha or revision ID, the retried + // build will use the identical source. + // + // For builds that specify `StorageSource`: + // + // * If the original build pulled source from Google Cloud Storage without + // specifying the generation of the object, the new build will use the current + // object, which may be different from the original build source. + // * If the original build pulled source from Cloud Storage and specified the + // generation of the object, the new build will attempt to use the same + // object, which may or may not be available depending on the bucket's + // lifecycle management settings. + rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:retry" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:retry" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,id"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Approves or rejects a pending build. + // + // If approved, the returned LRO will be analogous to the LRO returned from + // a CreateBuild call. + // + // If rejected, the returned LRO will be immediately done. + rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/builds/*}:approve" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:approve" + body: "*" + } + }; + option (google.api.method_signature) = "name,approval_result"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Creates a new `BuildTrigger`. + // + // This API is experimental. + rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers" + body: "trigger" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*}/triggers" + body: "trigger" + } + }; + option (google.api.method_signature) = "project_id,trigger"; + } + + // Returns information about a `BuildTrigger`. + // + // This API is experimental. + rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Lists existing `BuildTrigger`s. + // + // This API is experimental. + rpc ListBuildTriggers(ListBuildTriggersRequest) + returns (ListBuildTriggersResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*}/triggers" + } + }; + option (google.api.method_signature) = "project_id"; + } + + // Deletes a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Updates a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + patch: "/v1/projects/{project_id}/triggers/{trigger_id}" + body: "trigger" + additional_bindings { + patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" + body: "trigger" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,trigger"; + } + + // Runs a `BuildTrigger` at a particular source revision. + rpc RunBuildTrigger(RunBuildTriggerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" + body: "source" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:run" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,source"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // ReceiveTriggerWebhook [Experimental] is called when the API receives a + // webhook request targeted at a specific trigger. + rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) + returns (ReceiveTriggerWebhookResponse) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" + body: "body" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" + body: "body" + } + }; + } + + // Creates a `WorkerPool`. + rpc CreateWorkerPool(CreateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workerPools" + body: "worker_pool" + }; + option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "CreateWorkerPoolOperationMetadata" + }; + } + + // Returns details of a `WorkerPool`. + rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a `WorkerPool`. + rpc DeleteWorkerPool(DeleteWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteWorkerPoolOperationMetadata" + }; + } + + // Updates a `WorkerPool`. + rpc UpdateWorkerPool(UpdateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" + body: "worker_pool" + }; + option (google.api.method_signature) = "worker_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "UpdateWorkerPoolOperationMetadata" + }; + } + + // Lists `WorkerPool`s. + rpc ListWorkerPools(ListWorkerPoolsRequest) + returns (ListWorkerPoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workerPools" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Specifies a build to retry. +message RetryBuildRequest { + // The name of the `Build` to retry. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Build ID of the original build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies a build trigger to run and the source to use. +message RunBuildTriggerRequest { + // The name of the `Trigger` to run. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the trigger. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Source to build against this trigger. + RepoSource source = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + string dir = 7; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 8; + + // Substitutions to use in a triggered build. + // Should only be used with RunBuildTrigger + map substitutions = 9; +} + +// Location of the source manifest in Google Cloud Storage. +// This feature is in Preview; see description +// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). +message StorageSourceManifest { + // Google Cloud Storage bucket containing the source manifest (see [Bucket + // Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source manifest. + // + // This object must be a JSON file. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a supported storage service. +message Source { + // Location of source. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 2; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 3; + + // If provided, get the source from this manifest in Google Cloud Storage. + // This feature is in Preview; see description + // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). + StorageSourceManifest storage_source_manifest = 8; + } +} + +// An image built by the pipeline. +message BuiltImage { + // Name used to push the container image to Google Container Registry, as + // presented to `docker push`. + string name = 1; + + // Docker Registry 2.0 digest. + string digest = 3; + + // Output only. Stores timing information for pushing the specified image. + TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A step in the build pipeline. +message BuildStep { + // Required. The name of the container image that will run this particular + // build step. + // + // If the image is available in the host's Docker daemon's cache, it + // will be run directly. If not, the host will attempt to pull the image + // first, using the builder service account's credentials if necessary. + // + // The Docker daemon's cache will already have the latest versions of all of + // the officially supported build steps + // ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). + // The Docker daemon will also have cached many of the layers for some popular + // images, like "ubuntu", "debian", but they will be refreshed at the time you + // attempt to use them. + // + // If you built an image in a previous build step, it will be stored in the + // host's Docker daemon's cache and is available to use as the name for a + // later build step. + string name = 1; + + // A list of environment variable definitions to be used when running a step. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 2; + + // A list of arguments that will be presented to the step when it is started. + // + // If the image used to run the step's container has an entrypoint, the `args` + // are used as arguments to that entrypoint. If the image does not define + // an entrypoint, the first element in args is used as the entrypoint, + // and the remainder will be used as arguments. + repeated string args = 3; + + // Working directory to use when running this step's container. + // + // If this value is a relative path, it is relative to the build's working + // directory. If this value is absolute, it may be outside the build's working + // directory, in which case the contents of the path may not be persisted + // across build step executions, unless a `volume` for that path is specified. + // + // If the build specifies a `RepoSource` with `dir` and a step with a `dir`, + // which specifies an absolute path, the `RepoSource` `dir` is ignored for + // the step's execution. + string dir = 4; + + // Unique identifier for this build step, used in `wait_for` to + // reference this build step as a dependency. + string id = 5; + + // The ID(s) of the step(s) that this build step depends on. + // This build step will not start until all the build steps in `wait_for` + // have completed successfully. If `wait_for` is empty, this build step will + // start when all previous build steps in the `Build.Steps` list have + // completed successfully. + repeated string wait_for = 6; + + // Entrypoint to be used instead of the build step image's default entrypoint. + // If unset, the image's default entrypoint is used. + string entrypoint = 7; + + // A list of environment variables which are encrypted using a Cloud Key + // Management Service crypto key. These values must be specified in the + // build's `Secret`. + repeated string secret_env = 8; + + // List of volumes to mount into the build step. + // + // Each volume is created as an empty volume prior to execution of the + // build step. Upon completion of the build, volumes and their contents are + // discarded. + // + // Using a named volume in only one step is not valid as it is indicative + // of a build request with an incorrect configuration. + repeated Volume volumes = 9; + + // Output only. Stores timing information for executing this build step. + TimeSpan timing = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Stores timing information for pulling this build step's + // builder image only. + TimeSpan pull_timing = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Time limit for executing this build step. If not defined, the step has no + // time limit and will be allowed to continue to run until either it completes + // or the build itself times out. + google.protobuf.Duration timeout = 11; + + // Output only. Status of the build step. At this time, build step status is + // only updated on build completion; step status is not updated in real-time + // as the build progresses. + Build.Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A shell script to be executed in the step. + // + // When script is provided, the user cannot specify the entrypoint or args. + string script = 19; +} + +// Volume describes a Docker container volume which is mounted into build steps +// in order to persist files across build step execution. +message Volume { + // Name of the volume to mount. + // + // Volume names must be unique per build step and must be valid names for + // Docker volumes. Each named volume must be used by at least two build steps. + string name = 1; + + // Path at which to mount the volume. + // + // Paths must be absolute and cannot conflict with other volume paths on the + // same build step or with certain reserved volume paths. + string path = 2; +} + +// Artifacts created by the build pipeline. +message Results { + // Container images that were built as a part of the build. + repeated BuiltImage images = 2; + + // List of build step digests, in the order corresponding to build step + // indices. + repeated string build_step_images = 3; + + // Path to the artifact manifest. Only populated when artifacts are uploaded. + string artifact_manifest = 4; + + // Number of artifacts uploaded. Only populated when artifacts are uploaded. + int64 num_artifacts = 5; + + // List of build step outputs, produced by builder images, in the order + // corresponding to build step indices. + // + // [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) + // can produce this output by writing to `$BUILDER_OUTPUT/output`. + // Only the first 4KB of data is stored. + repeated bytes build_step_outputs = 6; + + // Time to push all non-container artifacts. + TimeSpan artifact_timing = 7; +} + +// An artifact that was uploaded during a build. This +// is a single record in the artifact manifest JSON file. +message ArtifactResult { + // The path of an artifact in a Google Cloud Storage bucket, with the + // generation number. For example, + // `gs://mybucket/path/to/output.jar#generation`. + string location = 1; + + // The file hash of the artifact. + repeated FileHashes file_hash = 2; +} + +// A build resource in the Cloud Build API. +// +// At a high level, a `Build` describes where to find source code, how to build +// it (for example, the builder image to run on the source), and where to store +// the built artifacts. +// +// Fields can include the following variables, which will be expanded when the +// build is created: +// +// - $PROJECT_ID: the project ID of the build. +// - $PROJECT_NUMBER: the project number of the build. +// - $BUILD_ID: the autogenerated ID of the build. +// - $REPO_NAME: the source repository name specified by RepoSource. +// - $BRANCH_NAME: the branch name specified by RepoSource. +// - $TAG_NAME: the tag name specified by RepoSource. +// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or +// resolved from the specified branch or tag. +// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. +message Build { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/builds/{build}" + pattern: "projects/{project}/locations/{location}/builds/{build}" + }; + + // A non-fatal problem encountered during the execution of the build. + message Warning { + // The relative importance of this warning. + enum Priority { + // Should not be used. + PRIORITY_UNSPECIFIED = 0; + + // e.g. deprecation warnings and alternative feature highlights. + INFO = 1; + + // e.g. automated detection of possible issues with the build. + WARNING = 2; + + // e.g. alerts that a feature used in the build is pending removal + ALERT = 3; + } + + // Explanation of the warning generated. + string text = 1; + + // The priority for this warning. + Priority priority = 2; + } + + // A fatal problem encountered during the execution of the build. + message FailureInfo { + // The name of a fatal problem encountered during the execution of the + // build. + enum FailureType { + // Type unspecified + FAILURE_TYPE_UNSPECIFIED = 0; + + // Unable to push the image to the repository. + PUSH_FAILED = 1; + + // Final image not found. + PUSH_IMAGE_NOT_FOUND = 2; + + // Unauthorized push of the final image. + PUSH_NOT_AUTHORIZED = 3; + + // Backend logging failures. Should retry. + LOGGING_FAILURE = 4; + + // A build step has failed. + USER_BUILD_STEP = 5; + + // The source fetching has failed. + FETCH_SOURCE_FAILED = 6; + } + + // The name of the failure. + FailureType type = 1; + + // Explains the failure issue in more detail using hard-coded text. + string detail = 2; + } + + // Possible status of a build or build step. + enum Status { + // Status of the build is unknown. + STATUS_UNKNOWN = 0; + + // Build has been created and is pending execution and queuing. It has not + // been queued. + PENDING = 10; + + // Build or step is queued; work has not yet begun. + QUEUED = 1; + + // Build or step is being executed. + WORKING = 2; + + // Build or step finished successfully. + SUCCESS = 3; + + // Build or step failed to complete successfully. + FAILURE = 4; + + // Build or step failed due to an internal cause. + INTERNAL_ERROR = 5; + + // Build or step took longer than was allowed. + TIMEOUT = 6; + + // Build or step was canceled by a user. + CANCELLED = 7; + + // Build was enqueued for longer than the value of `queue_ttl`. + EXPIRED = 9; + } + + // Output only. The 'Build' name with format: + // `projects/{project}/locations/{location}/builds/{build}`, where {build} + // is a unique identifier generated by the service. + string name = 45 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Unique identifier of the build. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the project. + string project_id = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Status of the build. + Status status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Customer-readable message about the current status. + string status_detail = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The location of the source files to build. + Source source = 3; + + // Required. The operations to be performed on the workspace. + repeated BuildStep steps = 11; + + // Output only. Results of the build. + Results results = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to create the build was received. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which execution of the build was started. + google.protobuf.Timestamp start_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which execution of the build was finished. + // + // The difference between finish_time and start_time is the duration of the + // build's execution. + google.protobuf.Timestamp finish_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Amount of time that this build should be allowed to run, to second + // granularity. If this amount of time elapses, work on the build will cease + // and the build status will be `TIMEOUT`. + // + // `timeout` starts ticking from `startTime`. + // + // Default time is ten minutes. + google.protobuf.Duration timeout = 12; + + // A list of images to be pushed upon the successful completion of all build + // steps. + // + // The images are pushed using the builder service account's credentials. + // + // The digests of the pushed images will be stored in the `Build` resource's + // results field. + // + // If any of the images fail to be pushed, the build status is marked + // `FAILURE`. + repeated string images = 13; + + // TTL in queue for this build. If provided and the build is enqueued longer + // than this value, the build will expire and the build status will be + // `EXPIRED`. + // + // The TTL starts ticking from create_time. + google.protobuf.Duration queue_ttl = 40; + + // Artifacts produced by the build that should be uploaded upon + // successful completion of all build steps. + Artifacts artifacts = 37; + + // Google Cloud Storage bucket where logs should be written (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. + string logs_bucket = 19; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The ID of the `BuildTrigger` that triggered this build, if it + // was triggered automatically. + string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Special options for this build. + BuildOptions options = 23; + + // Output only. URL to logs for this build in Google Cloud Console. + string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Substitutions data for `Build` resource. + map substitutions = 29; + + // Tags for annotation of a `Build`. These are not docker tags. + repeated string tags = 31; + + // Secrets to decrypt using Cloud Key Management Service. + // Note: Secret Manager is the recommended technique + // for managing sensitive data with Cloud Build. Use `available_secrets` to + // configure builds to access secrets from Secret Manager. For instructions, + // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets + repeated Secret secrets = 32; + + // Output only. Stores timing information for phases of the build. Valid keys + // are: + // + // * BUILD: time to execute all build steps. + // * PUSH: time to push all specified images. + // * FETCHSOURCE: time to fetch source. + // * SETUPBUILD: time to set up build. + // + // If the build does not specify source or images, + // these keys will not be included. + map timing = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Describes this build's approval configuration, status, + // and result. + BuildApproval approval = 44 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // IAM service account whose credentials will be used at build runtime. + // Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + // ACCOUNT can be email address or uniqueId of the service account. + // + string service_account = 42 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // Secrets and secret environment variables. + Secrets available_secrets = 47; + + // Output only. Non-fatal problems encountered during the execution of the + // build. + repeated Warning warnings = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Contains information about the build when status=FAILURE. + FailureInfo failure_info = 51 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Artifacts produced by a build that should be uploaded upon +// successful completion of all build steps. +message Artifacts { + // Files in the workspace to upload to Cloud Storage upon successful + // completion of all build steps. + message ArtifactObjects { + // Cloud Storage bucket and optional object path, in the form + // "gs://bucket/path/to/somewhere/". (see [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // + // Files in the workspace matching any path pattern will be uploaded to + // Cloud Storage with this location as a prefix. + string location = 1; + + // Path globs used to match files in the build's workspace. + repeated string paths = 2; + + // Output only. Stores timing information for pushing all artifact objects. + TimeSpan timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // A list of images to be pushed upon the successful completion of all build + // steps. + // + // The images will be pushed using the builder service account's credentials. + // + // The digests of the pushed images will be stored in the Build resource's + // results field. + // + // If any of the images fail to be pushed, the build is marked FAILURE. + repeated string images = 1; + + // A list of objects to be uploaded to Cloud Storage upon successful + // completion of all build steps. + // + // Files in the workspace matching specified paths globs will be uploaded to + // the specified Cloud Storage location using the builder service account's + // credentials. + // + // The location and generation of the uploaded objects will be stored in the + // Build resource's results field. + // + // If any objects fail to be pushed, the build is marked FAILURE. + ArtifactObjects objects = 2; +} + +// Start and end times for a build execution phase. +message TimeSpan { + // Start of time span. + google.protobuf.Timestamp start_time = 1; + + // End of time span. + google.protobuf.Timestamp end_time = 2; +} + +// Metadata for build operations. +message BuildOperationMetadata { + // The build that the operation is tracking. + Build build = 1; +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 3; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 6; + + // A copy of the build's `source.storage_source_manifest`, if exists, with any + // revisions resolved. + // This feature is in Preview. + StorageSourceManifest resolved_storage_source_manifest = 9; + + // Output only. Hash(es) of the build source, which can be used to verify that + // the original source integrity was maintained in the build. Note that + // `FileHashes` will only be populated if `BuildOptions` has requested a + // `SourceProvenanceHash`. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (`.tar.gz`), the `FileHash` will be for the single path to that file. + map file_hashes = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Container message for hashes of byte content of files, used in +// SourceProvenance messages to verify integrity of source input to the build. +message FileHashes { + // Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Specifies the hash algorithm, if any. + enum HashType { + // No hash requested. + NONE = 0; + + // Use a sha256 hash. + SHA256 = 1; + + // Use a md5 hash. + MD5 = 2; + } + + // The type of hash that was performed. + HashType type = 1; + + // The hash value. + bytes value = 2; +} + +// Secrets and secret environment variables. +message Secrets { + // Secrets in Secret Manager and associated secret environment variable. + repeated SecretManagerSecret secret_manager = 1; + + // Secrets encrypted with KMS key and the associated secret environment + // variable. + repeated InlineSecret inline = 2; +} + +// Pairs a set of secret environment variables mapped to encrypted +// values with the Cloud KMS key to use to decrypt the value. +message InlineSecret { + // Resource name of Cloud KMS crypto key to decrypt the encrypted value. + // In format: projects/*/locations/*/keyRings/*/cryptoKeys/* + string kms_key_name = 1 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // Map of environment variable name to its encrypted value. + // + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. Values can be at most + // 64 KB in size. There can be at most 100 secret values across all of a + // build's secrets. + map env_map = 2; +} + +// Pairs a secret environment variable with a SecretVersion in Secret Manager. +message SecretManagerSecret { + // Resource name of the SecretVersion. In format: + // projects/*/secrets/*/versions/* + string version_name = 1 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // Environment variable name to associate with the secret. + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. + string env = 2; +} + +// Pairs a set of secret environment variables containing encrypted +// values with the Cloud KMS key to use to decrypt the value. +// Note: Use `kmsKeyName` with `available_secrets` instead of using +// `kmsKeyName` with `secret`. For instructions see: +// https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials. +message Secret { + // Cloud KMS key name to use to decrypt these envs. + string kms_key_name = 1; + + // Map of environment variable name to its encrypted value. + // + // Secret environment variables must be unique across all of a build's + // secrets, and must be used by at least one build step. Values can be at most + // 64 KB in size. There can be at most 100 secret values across all of a + // build's secrets. + map secret_env = 3; +} + +// Request to create a new build. +message CreateBuildRequest { + // The parent resource where this build will be created. + // Format: `projects/{project}/locations/{location}` + string parent = 4 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Build resource to create. + Build build = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to get a build. +message GetBuildRequest { + // The name of the `Build` to retrieve. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list builds. +message ListBuildsRequest { + // The parent of the collection of `Builds`. + // Format: `projects/{project}/locations/location` + string parent = 9 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of results to return in the list. + int32 page_size = 2; + + // The page token for the next page of Builds. + // + // If unspecified, the first page of results is returned. + // + // If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + // In this case, the token should be discarded, and pagination should be + // restarted from the first page of results. + // + // See https://google.aip.dev/158 for more. + string page_token = 3; + + // The raw filter text to constrain the results. + string filter = 8; +} + +// Response including listed builds. +message ListBuildsResponse { + // Builds will be sorted by `create_time`, descending. + repeated Build builds = 1; + + // Token to receive the next page of results. + // This will be absent if the end of the response list has been reached. + string next_page_token = 2; +} + +// Request to cancel an ongoing build. +message CancelBuildRequest { + // The name of the `Build` to cancel. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to approve or reject a pending build. +message ApproveBuildRequest { + // Required. Name of the target build. + // For example: "projects/{$project_id}/builds/{$build_id}" + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Approval decision and metadata. + ApprovalResult approval_result = 2; +} + +// BuildApproval describes a build's approval configuration, state, and +// result. +message BuildApproval { + // Specifies the current state of a build's approval. + enum State { + // Default enum type. This should not be used. + STATE_UNSPECIFIED = 0; + + // Build approval is pending. + PENDING = 1; + + // Build approval has been approved. + APPROVED = 2; + + // Build approval has been rejected. + REJECTED = 3; + + // Build was cancelled while it was still pending approval. + CANCELLED = 5; + } + + // Output only. The state of this build's approval. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Configuration for manual approval of this build. + ApprovalConfig config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Result of manual approval for this Build. + ApprovalResult result = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ApprovalConfig describes configuration for manual approval of a build. +message ApprovalConfig { + // Whether or not approval is needed. If this is set on a build, it will + // become pending when created, and will need to be explicitly approved + // to start. + bool approval_required = 1; +} + +// ApprovalResult describes the decision and associated metadata of a manual +// approval of a build. +message ApprovalResult { + // Specifies whether or not this manual approval result is to approve + // or reject a build. + enum Decision { + // Default enum type. This should not be used. + DECISION_UNSPECIFIED = 0; + + // Build is approved. + APPROVED = 1; + + // Build is rejected. + REJECTED = 2; + } + + // Output only. Email of the user that called the ApproveBuild API to + // approve or reject a build at the time that the API was called. + string approver_account = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the approval decision was made. + google.protobuf.Timestamp approval_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The decision of this manual approval. + Decision decision = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional comment for this manual approval result. + string comment = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional URL tied to this manual approval result. This field + // is essentially the same as comment, except that it will be rendered by the + // UI differently. An example use case is a link to an external job that + // approved this Build. + string url = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Configuration for an automated build in response to source repository +// changes. +message BuildTrigger { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + plural: "triggers" + singular: "trigger" + pattern: "projects/{project}/triggers/{trigger}" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + }; + + // The `Trigger` name with format: + // `projects/{project}/locations/{location}/triggers/{trigger}`, where + // {trigger} is a unique identifier generated by the service. + string resource_name = 34; + + // Output only. Unique identifier of the trigger. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Human-readable description of this trigger. + string description = 10; + + // User-assigned name of the trigger. Must be unique within the project. + // Trigger names must meet the following requirements: + // + // + They must contain only alphanumeric characters and dashes. + // + They can be 1-64 characters long. + // + They must begin and end with an alphanumeric character. + string name = 21; + + // Tags for annotation of a `BuildTrigger` + repeated string tags = 19; + + // Template describing the types of source changes to trigger a build. + // + // Branch and tag names in trigger templates are interpreted as regular + // expressions. Any branch or tag change that matches that regular expression + // will trigger a build. + // + // Mutually exclusive with `github`. + RepoSource trigger_template = 7; + + // GitHubEventsConfig describes the configuration of a trigger that creates + // a build whenever a GitHub event is received. + // + // Mutually exclusive with `trigger_template`. + GitHubEventsConfig github = 13; + + // PubsubConfig describes the configuration of a trigger that + // creates a build whenever a Pub/Sub message is published. + PubsubConfig pubsub_config = 29; + + // WebhookConfig describes the configuration of a trigger that + // creates a build whenever a webhook is sent to a trigger's webhook URL. + WebhookConfig webhook_config = 31; + + // Template describing the Build request to make when the trigger is matched. + oneof build_template { + // Autodetect build configuration. The following precedence is used (case + // insensitive): + // + // 1. cloudbuild.yaml + // 2. cloudbuild.yml + // 3. cloudbuild.json + // 4. Dockerfile + // + // Currently only available for GitHub App Triggers. + bool autodetect = 18; + + // Contents of the build template. + Build build = 4; + + // Path, from the source root, to the build configuration file + // (i.e. cloudbuild.yaml). + string filename = 8; + } + + // Output only. Time when the trigger was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If true, the trigger will never automatically execute a build. + bool disabled = 9; + + // Substitutions for Build resource. The keys must match the following + // regular expression: `^_[A-Z0-9_]+$`. + map substitutions = 11; + + // ignored_files and included_files are file glob matches using + // https://golang.org/pkg/path/filepath/#Match extended with support for "**". + // + // If ignored_files and changed files are both empty, then they are + // not used to determine whether or not to trigger a build. + // + // If ignored_files is not empty, then we ignore any files that match + // any of the ignored_file globs. If the change has no files that are + // outside of the ignored_files globs, then we do not trigger a build. + repeated string ignored_files = 15; + + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is empty, then as far as this filter is + // concerned, we should trigger the build. + // + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is not empty, then we make sure that at + // least one of those files matches a included_files glob. If not, + // then we do not trigger a build. + repeated string included_files = 16; + + // Optional. A Common Expression Language string. + string filter = 30 [(google.api.field_behavior) = OPTIONAL]; + + // The service account used for all user-controlled operations including + // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. + // If no service account is set, then the standard Cloud Build service account + // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. + // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` + string service_account = 33 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; +} + +// GitHubEventsConfig describes the configuration of a trigger that creates a +// build whenever a GitHub event is received. +// +// This message is experimental. +message GitHubEventsConfig { + // The installationID that emits the GitHub event. + int64 installation_id = 1 [deprecated = true]; + + // Owner of the repository. For example: The owner for + // https://github.com/googlecloudplatform/cloud-builders is + // "googlecloudplatform". + string owner = 6; + + // Name of the repository. For example: The name for + // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". + string name = 7; + + // Filter describing the types of events to trigger a build. + // Currently supported event types: push, pull_request. + oneof event { + // filter to match changes in pull requests. + PullRequestFilter pull_request = 4; + + // filter to match changes in refs like branches, tags. + PushFilter push = 5; + } +} + +// PubsubConfig describes the configuration of a trigger that +// creates a build whenever a Pub/Sub message is published. +message PubsubConfig { + // Enumerates potential issues with the underlying Pub/Sub subscription + // configuration. + enum State { + // The subscription configuration has not been checked. + STATE_UNSPECIFIED = 0; + + // The Pub/Sub subscription is properly configured. + OK = 1; + + // The subscription has been deleted. + SUBSCRIPTION_DELETED = 2; + + // The topic has been deleted. + TOPIC_DELETED = 3; + + // Some of the subscription's field are misconfigured. + SUBSCRIPTION_MISCONFIGURED = 4; + } + + // Output only. Name of the subscription. Format is + // `projects/{project}/subscriptions/{subscription}`. + string subscription = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Subscription" + } + ]; + + // The name of the topic from which this subscription is receiving messages. + // Format is `projects/{project}/topics/{topic}`. + string topic = 2 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Service account that will make the push request. + string service_account_email = 3 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// WebhookConfig describes the configuration of a trigger that +// creates a build whenever a webhook is sent to a trigger's webhook URL. +message WebhookConfig { + // Enumerates potential issues with the Secret Manager secret provided by the + // user. + enum State { + // The webhook auth configuration not been checked. + STATE_UNSPECIFIED = 0; + + // The auth configuration is properly setup. + OK = 1; + + // The secret provided in auth_method has been deleted. + SECRET_DELETED = 2; + } + + // Auth method specifies how the webhook authenticates with GCP. + oneof auth_method { + // Required. Resource name for the secret required as a URL parameter. + string secret = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + } + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// PullRequestFilter contains filter properties for matching GitHub Pull +// Requests. +message PullRequestFilter { + // Controls behavior of Pull Request comments. + enum CommentControl { + // Do not require comments on Pull Requests before builds are triggered. + COMMENTS_DISABLED = 0; + + // Enforce that repository owners or collaborators must comment on Pull + // Requests before builds are triggered. + COMMENTS_ENABLED = 1; + + // Enforce that repository owners or collaborators must comment on external + // contributors' Pull Requests before builds are triggered. + COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; + } + + // Target refs to match. + // A target ref is the git reference where the pull request will be applied. + oneof git_ref { + // Regex of branches to match. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch = 2; + } + + // Configure builds to run whether a repository owner or collaborator need to + // comment `/gcbrun`. + CommentControl comment_control = 5; + + // If true, branches that do NOT match the git_ref will trigger a build. + bool invert_regex = 6; +} + +// Push contains filter properties for matching GitHub git pushes. +message PushFilter { + // Modified refs to match. + // A modified refs are the refs modified by a git push operation. + oneof git_ref { + // Regexes matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch = 2; + + // Regexes matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag = 3; + } + + // When true, only trigger a build if the revision regex does NOT match the + // git_ref regex. + bool invert_regex = 4; +} + +// Request to create a new `BuildTrigger`. +message CreateBuildTriggerRequest { + // The parent resource where this trigger will be created. + // Format: `projects/{project}/locations/{location}` + string parent = 3 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to configure automatic builds. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to create. + BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Returns the `BuildTrigger` with the specified ID. +message GetBuildTriggerRequest { + // The name of the `Trigger` to retrieve. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list existing `BuildTriggers`. +message ListBuildTriggersRequest { + // The parent of the collection of `Triggers`. + // Format: `projects/{project}/locations/{location}` + string parent = 4 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to list BuildTriggers. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Token to provide to skip to a particular spot in the list. + string page_token = 3; +} + +// Response containing existing `BuildTriggers`. +message ListBuildTriggersResponse { + // `BuildTriggers` for the project, sorted by `create_time` descending. + repeated BuildTrigger triggers = 1; + + // Token to receive the next page of results. + string next_page_token = 2; +} + +// Request to delete a `BuildTrigger`. +message DeleteBuildTriggerRequest { + // The name of the `Trigger` to delete. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to delete. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update an existing `BuildTrigger`. +message UpdateBuildTriggerRequest { + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to update. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to update. + BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Optional arguments to enable specific features of builds. +message BuildOptions { + // Details about how a build should be executed on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + message PoolOption { + // The `WorkerPool` resource to execute the build on. + // You must have `cloudbuild.workerpools.use` on the project hosting the + // WorkerPool. + // + // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} + string name = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + } + + // Specifies the manner in which the build should be verified, if at all. + enum VerifyOption { + // Not a verifiable build. (default) + NOT_VERIFIED = 0; + + // Verified build. + VERIFIED = 1; + } + + // Supported Compute Engine machine types. + // For more information, see [Machine + // types](https://cloud.google.com/compute/docs/machine-types). + enum MachineType { + // Standard machine type. + UNSPECIFIED = 0; + + // Highcpu machine with 8 CPUs. + N1_HIGHCPU_8 = 1; + + // Highcpu machine with 32 CPUs. + N1_HIGHCPU_32 = 2; + + // Highcpu e2 machine with 8 CPUs. + E2_HIGHCPU_8 = 5; + + // Highcpu e2 machine with 32 CPUs. + E2_HIGHCPU_32 = 6; + } + + // Specifies the behavior when there is an error in the substitution checks. + enum SubstitutionOption { + // Fails the build if error in substitutions checks, like missing + // a substitution in the template or in the map. + MUST_MATCH = 0; + + // Do not fail the build if error in substitutions checks. + ALLOW_LOOSE = 1; + } + + // Specifies the behavior when writing build logs to Google Cloud Storage. + enum LogStreamingOption { + // Service may automatically determine build log streaming behavior. + STREAM_DEFAULT = 0; + + // Build logs should be streamed to Google Cloud Storage. + STREAM_ON = 1; + + // Build logs should not be streamed to Google Cloud Storage; they will be + // written when the build is completed. + STREAM_OFF = 2; + } + + // Specifies the logging mode. + enum LoggingMode { + // The service determines the logging mode. The default is `LEGACY`. Do not + // rely on the default logging behavior as it may change in the future. + LOGGING_UNSPECIFIED = 0; + + // Cloud Logging and Cloud Storage logging are enabled. + LEGACY = 1; + + // Only Cloud Storage logging is enabled. + GCS_ONLY = 2; + + // This option is the same as CLOUD_LOGGING_ONLY. + STACKDRIVER_ONLY = 3 [deprecated = true]; + + // Only Cloud Logging is enabled. Note that logs for both the Cloud Console + // UI and Cloud SDK are based on Cloud Storage logs, so neither will provide + // logs if this option is chosen. + CLOUD_LOGGING_ONLY = 5; + + // Turn off all logging. No build logs will be captured. + NONE = 4; + } + + // Requested hash for SourceProvenance. + repeated Hash.HashType source_provenance_hash = 1; + + // Requested verifiability options. + VerifyOption requested_verify_option = 2; + + // Compute Engine machine type on which to run the build. + MachineType machine_type = 3; + + // Requested disk size for the VM that runs the build. Note that this is *NOT* + // "disk free"; some of the space will be used by the operating system and + // build utilities. Also note that this is the minimum disk size that will be + // allocated for the build -- the build may run with a larger disk than + // requested. At present, the maximum disk size is 1000GB; builds that request + // more than the maximum are rejected with an error. + int64 disk_size_gb = 6; + + // Option to specify behavior when there is an error in the substitution + // checks. + // + // NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot + // be overridden in the build configuration file. + SubstitutionOption substitution_option = 4; + + // Option to specify whether or not to apply bash style string + // operations to the substitutions. + // + // NOTE: this is always enabled for triggered builds and cannot be + // overridden in the build configuration file. + bool dynamic_substitutions = 17; + + // Option to define build log streaming behavior to Google Cloud + // Storage. + LogStreamingOption log_streaming_option = 5; + + // This field deprecated; please use `pool.name` instead. + string worker_pool = 7 [deprecated = true]; + + // Optional. Specification for execution on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Option to specify the logging mode, which determines if and where build + // logs are stored. + LoggingMode logging = 11; + + // A list of global environment variable definitions that will exist for all + // build steps in this build. If a variable is defined in both globally and in + // a build step, the variable will use the build step value. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 12; + + // A list of global environment variables, which are encrypted using a Cloud + // Key Management Service crypto key. These values must be specified in the + // build's `Secret`. These variables will be available to all build steps + // in this build. + repeated string secret_env = 13; + + // Global list of volumes to mount for ALL build steps + // + // Each volume is created as an empty volume prior to starting the build + // process. Upon completion of the build, volumes and their contents are + // discarded. Global volume names and paths cannot conflict with the volumes + // defined a build step. + // + // Using a global volume in a build with only one step is not valid as + // it is indicative of a build request with an incorrect configuration. + repeated Volume volumes = 14; +} + +// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by +// the ReceiveTriggerWebhook method. +message ReceiveTriggerWebhookRequest { + // The name of the `ReceiveTriggerWebhook` to retrieve. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 5; + + // HTTP request body. + google.api.HttpBody body = 1; + + // Project in which the specified trigger lives + string project_id = 2; + + // Name of the trigger to run the payload against + string trigger = 3; + + // Secret token used for authorization if an OAuth token isn't provided. + string secret = 4; +} + +// ReceiveTriggerWebhookResponse [Experimental] is the response object for the +// ReceiveTriggerWebhook method. +message ReceiveTriggerWebhookResponse {} + +// Configuration for a `WorkerPool`. +// +// Cloud Build owns and maintains a pool of workers for general use and have no +// access to a project's private network. By default, builds submitted to +// Cloud Build will use a worker from this pool. +// +// If your build needs access to resources on a private network, +// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give +// your builds access to any single VPC network that you +// administer, including any on-prem resources connected to that VPC +// network. For an overview of private pools, see +// [Private pools +// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). +message WorkerPool { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" + plural: "workerPools" + singular: "workerPool" + style: DECLARATIVE_FRIENDLY + }; + + // State of the `WorkerPool`. + enum State { + // State of the `WorkerPool` is unknown. + STATE_UNSPECIFIED = 0; + + // `WorkerPool` is being created. + CREATING = 1; + + // `WorkerPool` is running. + RUNNING = 2; + + // `WorkerPool` is being deleted: cancelling builds and draining workers. + DELETING = 3; + + // `WorkerPool` is deleted. + DELETED = 4; + } + + // Output only. The resource name of the `WorkerPool`, with format + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + // The value of `{worker_pool}` is provided by `worker_pool_id` in + // `CreateWorkerPool` request and the value of `{location}` is determined by + // the endpoint accessed. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-specified, human-readable name for the `WorkerPool`. If provided, + // this value must be 1-63 characters. + string display_name = 2; + + // Output only. A unique identifier for the `WorkerPool`. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified annotations. See https://google.aip.dev/128#annotations + // for more details such as format and size limitations. + map annotations = 4; + + // Output only. Time at which the request to create the `WorkerPool` was + // received. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to update the `WorkerPool` was + // received. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to delete the `WorkerPool` was + // received. + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `WorkerPool` state. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Private Pool configuration for the `WorkerPool`. + oneof config { + // Private Pool using a v1 configuration. + PrivatePoolV1Config private_pool_v1_config = 12; + } + + // Output only. Checksum computed by the server. May be sent on update and + // delete requests to ensure that the client has an up-to-date value before + // proceeding. + string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a V1 `PrivatePool`. +message PrivatePoolV1Config { + // Defines the configuration to be used for creating workers in + // the pool. + message WorkerConfig { + // Machine type of a worker, such as `e2-medium`. + // See [Worker pool config + // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). + // If left blank, Cloud Build will use a sensible default. + string machine_type = 1; + + // Size of the disk attached to the worker, in GB. + // See [Worker pool config + // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). + // Specify a value of up to 1000. If `0` is specified, Cloud Build will use + // a standard disk size. + int64 disk_size_gb = 2; + } + + // Defines the network configuration for the pool. + message NetworkConfig { + // Defines the egress option for the pool. + enum EgressOption { + // If set, defaults to PUBLIC_EGRESS. + EGRESS_OPTION_UNSPECIFIED = 0; + + // If set, workers are created without any public address, which prevents + // network egress to public IPs unless a network proxy is configured. + NO_PUBLIC_EGRESS = 1; + + // If set, workers are created with a public address which allows for + // public internet egress. + PUBLIC_EGRESS = 2; + } + + // Required. Immutable. The network definition that the workers are peered + // to. If this section is left empty, the workers will be peered to + // `WorkerPool.project_id` on the service producer network. Must be in the + // format `projects/{project}/global/networks/{network}`, where `{project}` + // is a project number, such as `12345`, and `{network}` is the name of a + // VPC network in the project. See + // [Understanding network configuration + // options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment) + string peered_network = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + } + ]; + + // Option to configure network egress for the workers. + EgressOption egress_option = 2; + } + + // Machine configuration for the workers in the pool. + WorkerConfig worker_config = 1; + + // Network configuration for the pool. + NetworkConfig network_config = 2; +} + +// Request to create a new `WorkerPool`. +message CreateWorkerPoolRequest { + // Required. The parent resource where this worker pool will be created. + // Format: `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. `WorkerPool` resource to create. + WorkerPool worker_pool = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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]-/. + string worker_pool_id = 3 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED + ]; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to get a `WorkerPool` with the specified name. +message GetWorkerPoolRequest { + // Required. The name of the `WorkerPool` to retrieve. + // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + } + ]; +} + +// Request to delete a `WorkerPool`. +message DeleteWorkerPoolRequest { + // Required. The name of the `WorkerPool` to delete. + // Format: + // `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + } + ]; + + // Optional. If this is provided, it must match the server's etag on the + // workerpool for the request to be processed. + string etag = 2; + + // If set to true, and the `WorkerPool` is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 3; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to update a `WorkerPool`. +message UpdateWorkerPoolRequest { + // Required. The `WorkerPool` to update. + // + // The `name` field is used to identify the `WorkerPool` to update. + // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask specifying which fields in `worker_pool` to update. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to list `WorkerPool`s. +message ListWorkerPoolsRequest { + // Required. The parent of the collection of `WorkerPools`. + // Format: `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of `WorkerPool`s to return. The service may return + // fewer than this value. If omitted, the server will use a sensible default. + int32 page_size = 2; + + // A page token, received from a previous `ListWorkerPools` call. Provide this + // to retrieve the subsequent page. + string page_token = 3; +} + +// Response containing existing `WorkerPools`. +message ListWorkerPoolsResponse { + // `WorkerPools` for the specified project. + repeated WorkerPool worker_pools = 1; + + // Continuation token used to page through large result sets. Provide this + // value in a subsequent ListWorkerPoolsRequest to return the next page of + // results. + string next_page_token = 2; +} + +// Metadata for the `CreateWorkerPool` operation. +message CreateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` to create. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `UpdateWorkerPool` operation. +message UpdateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being updated. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `DeleteWorkerPool` operation. +message DeleteWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being deleted. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js new file mode 100644 index 0000000..a6cafe4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js @@ -0,0 +1,64 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js new file mode 100644 index 0000000..8651a09 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js new file mode 100644 index 0000000..d6e6d1a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js @@ -0,0 +1,69 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js new file mode 100644 index 0000000..a24230d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js new file mode 100644 index 0000000..7361205 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js @@ -0,0 +1,78 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js new file mode 100644 index 0000000..43ff110 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js new file mode 100644 index 0000000..262eb44 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js @@ -0,0 +1,76 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the `WorkerPool` to delete. + * Format: + * `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. + */ + // const name = 'abc123' + /** + * Optional. If this is provided, it must match the server's etag on the + * workerpool for the request to be processed. + */ + // const etag = 'abc123' + /** + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + */ + // const allowMissing = true + /** + * 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 callDeleteWorkerPool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js new file mode 100644 index 0000000..786456d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, id) { + // [START cloudbuild_v1_generated_CloudBuild_GetBuild_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of the `Build` to retrieve. + * 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 callGetBuild() { + // Construct request + const request = { + projectId, + id, + }; + + // Run request + const response = await cloudbuildClient.getBuild(request); + console.log(response); + } + + callGetBuild(); + // [END cloudbuild_v1_generated_CloudBuild_GetBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js new file mode 100644 index 0000000..cd80fd6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, triggerId) { + // [START cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of the `Trigger` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * Required. ID of the project that owns the trigger. + */ + // const projectId = 'abc123' + /** + * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + */ + // const triggerId = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callGetBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + }; + + // Run request + const response = await cloudbuildClient.getBuildTrigger(request); + console.log(response); + } + + callGetBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js new file mode 100644 index 0000000..91ebfb8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js @@ -0,0 +1,59 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the `WorkerPool` to retrieve. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callGetWorkerPool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getWorkerPool(request); + console.log(response); + } + + callGetWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js new file mode 100644 index 0000000..869efee --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js @@ -0,0 +1,73 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId) { + // [START cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. ID of the project for which to list BuildTriggers. + */ + // const projectId = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Token to provide to skip to a particular spot in the list. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListBuildTriggers() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await cloudbuildClient.listBuildTriggersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuildTriggers(); + // [END cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js new file mode 100644 index 0000000..31ed683 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js @@ -0,0 +1,82 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId) { + // [START cloudbuild_v1_generated_CloudBuild_ListBuilds_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/location` + */ + // const parent = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * The page token for the next page of Builds. + * If unspecified, the first page of results is returned. + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * See https://google.aip.dev/158 for more. + */ + // const pageToken = 'abc123' + /** + * The raw filter text to constrain the results. + */ + // const filter = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListBuilds() { + // Construct request + const request = { + projectId, + }; + + // Run request + const iterable = await cloudbuildClient.listBuildsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBuilds(); + // [END cloudbuild_v1_generated_CloudBuild_ListBuilds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js new file mode 100644 index 0000000..c549bee --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js @@ -0,0 +1,71 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callListWorkerPools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listWorkerPoolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListWorkerPools(); + // [END cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js new file mode 100644 index 0000000..43900f3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js @@ -0,0 +1,74 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of the `ReceiveTriggerWebhook` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * HTTP request body. + */ + // const body = {} + /** + * Project in which the specified trigger lives + */ + // const projectId = 'abc123' + /** + * Name of the trigger to run the payload against + */ + // const trigger = 'abc123' + /** + * Secret token used for authorization if an OAuth token isn't provided. + */ + // const secret = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callReceiveTriggerWebhook() { + // Construct request + const request = { + }; + + // Run request + const response = await cloudbuildClient.receiveTriggerWebhook(request); + console.log(response); + } + + callReceiveTriggerWebhook(); + // [END cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js new file mode 100644 index 0000000..fb60578 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js @@ -0,0 +1,69 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, id) { + // [START cloudbuild_v1_generated_CloudBuild_RetryBuild_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of the `Build` to retry. + * Format: `projects/{project}/locations/{location}/builds/{build}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. Build ID of the original build. + */ + // const id = 'abc123' + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callRetryBuild() { + // Construct request + const request = { + projectId, + id, + }; + + // Run request + const [operation] = await cloudbuildClient.retryBuild(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRetryBuild(); + // [END cloudbuild_v1_generated_CloudBuild_RetryBuild_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js new file mode 100644 index 0000000..0d9714c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js @@ -0,0 +1,73 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, triggerId) { + // [START cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of the `Trigger` to run. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + */ + // const name = 'abc123' + /** + * Required. ID of the project. + */ + // const projectId = 'abc123' + /** + * Required. ID of the trigger. + */ + // const triggerId = 'abc123' + /** + * Source to build against this trigger. + */ + // const source = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callRunBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + }; + + // Run request + const [operation] = await cloudbuildClient.runBuildTrigger(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js new file mode 100644 index 0000000..b8d56ca --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js @@ -0,0 +1,68 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(projectId, triggerId, trigger) { + // [START cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. ID of the project that owns the trigger. + */ + // const projectId = 'abc123' + /** + * Required. ID of the `BuildTrigger` to update. + */ + // const triggerId = 'abc123' + /** + * Required. `BuildTrigger` to update. + */ + // const trigger = {} + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callUpdateBuildTrigger() { + // Construct request + const request = { + projectId, + triggerId, + trigger, + }; + + // Run request + const response = await cloudbuildClient.updateBuildTrigger(request); + console.log(response); + } + + callUpdateBuildTrigger(); + // [END cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js new file mode 100644 index 0000000..0417f4d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js @@ -0,0 +1,70 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(workerPool) { + // [START cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The `WorkerPool` to update. + * The `name` field is used to identify the `WorkerPool` to update. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const workerPool = {} + /** + * A mask specifying which fields in `worker_pool` to update. + */ + // const updateMask = {} + /** + * 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 callUpdateWorkerPool() { + // Construct request + const request = { + workerPool, + }; + + // Run request + const [operation] = await cloudbuildClient.updateWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json new file mode 100644 index 0000000..0c089e5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json @@ -0,0 +1,899 @@ +{ + "clientLibrary": { + "name": "nodejs-cloudbuild", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.cloudbuild.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuild_async", + "title": "CloudBuild createBuild Sample", + "origin": "API_DEFINITION", + "description": " Starts a build with the specified configuration. This method returns a long-running `Operation`, which includes the build ID. Pass the build ID to `GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).", + "canonical": true, + "file": "cloud_build.create_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "build", + "type": ".google.devtools.cloudbuild.v1.Build" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuild_async", + "title": "CloudBuild getBuild Sample", + "origin": "API_DEFINITION", + "description": " Returns information about a previously requested build. The `Build` that is returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and timing information.", + "canonical": true, + "file": "cloud_build.get_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.Build", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuilds_async", + "title": "CloudBuild listBuilds Sample", + "origin": "API_DEFINITION", + "description": " Lists previously requested builds. Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.", + "canonical": true, + "file": "cloud_build.list_builds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuilds", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListBuildsResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListBuilds", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CancelBuild_async", + "title": "CloudBuild cancelBuild Sample", + "origin": "API_DEFINITION", + "description": " Cancels a build in progress.", + "canonical": true, + "file": "cloud_build.cancel_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CancelBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.Build", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CancelBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_RetryBuild_async", + "title": "CloudBuild retryBuild Sample", + "origin": "API_DEFINITION", + "description": " Creates a new build based on the specified build. This method creates a new build using the original build request, which may or may not result in an identical build. For triggered builds: * Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision. For non-triggered builds that specify `RepoSource`: * If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build. * If the original build specified a commit sha or revision ID, the retried build will use the identical source. For builds that specify `StorageSource`: * If the original build pulled source from Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", + "canonical": true, + "file": "cloud_build.retry_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RetryBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "RetryBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ApproveBuild_async", + "title": "CloudBuild approveBuild Sample", + "origin": "API_DEFINITION", + "description": " Approves or rejects a pending build. If approved, the returned LRO will be analogous to the LRO returned from a CreateBuild call. If rejected, the returned LRO will be immediately done.", + "canonical": true, + "file": "cloud_build.approve_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ApproveBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "approval_result", + "type": ".google.devtools.cloudbuild.v1.ApprovalResult" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ApproveBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async", + "title": "CloudBuild createBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Creates a new `BuildTrigger`. This API is experimental.", + "canonical": true, + "file": "cloud_build.create_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": ".google.devtools.cloudbuild.v1.BuildTrigger" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async", + "title": "CloudBuild getBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Returns information about a `BuildTrigger`. This API is experimental.", + "canonical": true, + "file": "cloud_build.get_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async", + "title": "CloudBuild listBuildTriggers Sample", + "origin": "API_DEFINITION", + "description": " Lists existing `BuildTrigger`s. This API is experimental.", + "canonical": true, + "file": "cloud_build.list_build_triggers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBuildTriggers", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListBuildTriggersResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListBuildTriggers", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async", + "title": "CloudBuild deleteBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", + "canonical": true, + "file": "cloud_build.delete_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "DeleteBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async", + "title": "CloudBuild updateBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", + "canonical": true, + "file": "cloud_build.update_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", + "async": true, + "parameters": [ + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": ".google.devtools.cloudbuild.v1.BuildTrigger" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "UpdateBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async", + "title": "CloudBuild runBuildTrigger Sample", + "origin": "API_DEFINITION", + "description": " Runs a `BuildTrigger` at a particular source revision.", + "canonical": true, + "file": "cloud_build.run_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger_id", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.devtools.cloudbuild.v1.RepoSource" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "RunBuildTrigger", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async", + "title": "CloudBuild receiveTriggerWebhook Sample", + "origin": "API_DEFINITION", + "description": " ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.", + "canonical": true, + "file": "cloud_build.receive_trigger_webhook.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReceiveTriggerWebhook", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.api.HttpBody" + }, + { + "name": "project_id", + "type": "TYPE_STRING" + }, + { + "name": "trigger", + "type": "TYPE_STRING" + }, + { + "name": "secret", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ReceiveTriggerWebhook", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async", + "title": "CloudBuild createWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Creates a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.create_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "worker_pool", + "type": ".google.devtools.cloudbuild.v1.WorkerPool" + }, + { + "name": "worker_pool_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "CreateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async", + "title": "CloudBuild getWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Returns details of a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.get_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.WorkerPool", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "GetWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async", + "title": "CloudBuild deleteWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Deletes a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.delete_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "DeleteWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async", + "title": "CloudBuild updateWorkerPool Sample", + "origin": "API_DEFINITION", + "description": " Updates a `WorkerPool`.", + "canonical": true, + "file": "cloud_build.update_worker_pool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", + "async": true, + "parameters": [ + { + "name": "worker_pool", + "type": ".google.devtools.cloudbuild.v1.WorkerPool" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "UpdateWorkerPool", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + }, + { + "regionTag": "cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async", + "title": "CloudBuild listWorkerPools Sample", + "origin": "API_DEFINITION", + "description": " Lists `WorkerPool`s.", + "canonical": true, + "file": "cloud_build.list_worker_pools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkerPools", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v1.ListWorkerPoolsResponse", + "client": { + "shortName": "CloudBuildClient", + "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" + }, + "method": { + "shortName": "ListWorkerPools", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", + "service": { + "shortName": "CloudBuild", + "fullName": "google.devtools.cloudbuild.v1.CloudBuild" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..c4c9b78 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const CloudBuildClient = v1.CloudBuildClient; +type CloudBuildClient = v1.CloudBuildClient; +export {v1, CloudBuildClient}; +export default {v1, CloudBuildClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/v1/src/v1/cloud_build_client.ts new file mode 100644 index 0000000..7998805 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_build_client.ts @@ -0,0 +1,2878 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_build_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_build_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Creates and manages builds on Google Cloud Platform. + * + * The main concept used by this API is a `Build`, which describes the location + * of the source to build, how to build the source, and where to store the + * built artifacts, if any. + * + * A user can list previously-requested builds or get builds by their ID to + * determine the status of the build. + * @class + * @memberof v1 + */ +export class CloudBuildClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudBuildStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudBuildClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudBuildClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/builds/{build}' + ), + projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + projectTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/triggers/{trigger}' + ), + secretVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}/versions/{version}' + ), + serviceAccountPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/serviceAccounts/{service_account}' + ), + subscriptionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/subscriptions/{subscription}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBuilds: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'builds'), + listBuildTriggers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), + listWorkerPools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workerPools') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const createBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const retryBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const retryBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const approveBuildResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const approveBuildMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const runBuildTriggerResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; + const runBuildTriggerMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; + const createWorkerPoolResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; + const createWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata') as gax.protobuf.Type; + const deleteWorkerPoolResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata') as gax.protobuf.Type; + const updateWorkerPoolResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; + const updateWorkerPoolMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBuildResponse.decode.bind(createBuildResponse), + createBuildMetadata.decode.bind(createBuildMetadata)), + retryBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + retryBuildResponse.decode.bind(retryBuildResponse), + retryBuildMetadata.decode.bind(retryBuildMetadata)), + approveBuild: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + approveBuildResponse.decode.bind(approveBuildResponse), + approveBuildMetadata.decode.bind(approveBuildMetadata)), + runBuildTrigger: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runBuildTriggerResponse.decode.bind(runBuildTriggerResponse), + runBuildTriggerMetadata.decode.bind(runBuildTriggerMetadata)), + createWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkerPoolResponse.decode.bind(createWorkerPoolResponse), + createWorkerPoolMetadata.decode.bind(createWorkerPoolMetadata)), + deleteWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkerPoolResponse.decode.bind(deleteWorkerPoolResponse), + deleteWorkerPoolMetadata.decode.bind(deleteWorkerPoolMetadata)), + updateWorkerPool: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkerPoolResponse.decode.bind(updateWorkerPoolResponse), + updateWorkerPoolMetadata.decode.bind(updateWorkerPoolMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.cloudbuild.v1.CloudBuild', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudBuildStub) { + return this.cloudBuildStub; + } + + // Put together the "service stub" for + // google.devtools.cloudbuild.v1.CloudBuild. + this.cloudBuildStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v1.CloudBuild') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.cloudbuild.v1.CloudBuild, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudBuildStubMethods = + ['createBuild', 'getBuild', 'listBuilds', 'cancelBuild', 'retryBuild', 'approveBuild', 'createBuildTrigger', 'getBuildTrigger', 'listBuildTriggers', 'deleteBuildTrigger', 'updateBuildTrigger', 'runBuildTrigger', 'receiveTriggerWebhook', 'createWorkerPool', 'getWorkerPool', 'deleteWorkerPool', 'updateWorkerPool', 'listWorkerPools']; + for (const methodName of cloudBuildStubMethods) { + const callPromise = this.cloudBuildStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudBuildStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudbuild.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudbuild.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Returns information about a previously requested build. + * + * The `Build` that is returned includes its status (such as `SUCCESS`, + * `FAILURE`, or `WORKING`), and timing information. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to retrieve. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. ID of the build. + * @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 [Build]{@link google.devtools.cloudbuild.v1.Build}. + * 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/cloud_build.get_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuild_async + */ + getBuild( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined + ]>; + getBuild( + request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): void; + getBuild( + request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): void; + getBuild( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'id': request.id || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getBuild(request, options, callback); + } +/** + * Cancels a build in progress. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to cancel. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. ID of the build. + * @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 [Build]{@link google.devtools.cloudbuild.v1.Build}. + * 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/cloud_build.cancel_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CancelBuild_async + */ + cancelBuild( + request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined + ]>; + cancelBuild( + request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): void; + cancelBuild( + request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): void; + cancelBuild( + request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild, + protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'id': request.id || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.cancelBuild(request, options, callback); + } +/** + * Creates a new `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this trigger will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to configure automatic builds. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` to create. + * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. + * 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/cloud_build.create_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async + */ + createBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined + ]>; + createBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + createBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + createBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createBuildTrigger(request, options, callback); + } +/** + * Returns information about a `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. + * 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/cloud_build.get_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async + */ + getBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined + ]>; + getBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + getBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + getBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'trigger_id': request.triggerId || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getBuildTrigger(request, options, callback); + } +/** + * Deletes a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to delete. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to delete. + * @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/cloud_build.delete_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async + */ + deleteBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined + ]>; + deleteBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + deleteBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'trigger_id': request.triggerId || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteBuildTrigger(request, options, callback); + } +/** + * Updates a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to update. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` to update. + * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. + * 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/cloud_build.update_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async + */ + updateBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined + ]>; + updateBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): void; + updateBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger, + protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'trigger_id': request.triggerId || '', + 'trigger.resource_name': request.trigger!.resourceName || '', + }); + this.initialize(); + return this.innerApiCalls.updateBuildTrigger(request, options, callback); + } +/** + * ReceiveTriggerWebhook [Experimental] is called when the API receives a + * webhook request targeted at a specific trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `ReceiveTriggerWebhook` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {google.api.HttpBody} request.body + * HTTP request body. + * @param {string} request.projectId + * Project in which the specified trigger lives + * @param {string} request.trigger + * Name of the trigger to run the payload against + * @param {string} request.secret + * Secret token used for authorization if an OAuth token isn't provided. + * @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 [ReceiveTriggerWebhookResponse]{@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse}. + * 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/cloud_build.receive_trigger_webhook.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async + */ + receiveTriggerWebhook( + request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined + ]>; + receiveTriggerWebhook( + request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): void; + receiveTriggerWebhook( + request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): void; + receiveTriggerWebhook( + request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, + protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'trigger': request.trigger || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.receiveTriggerWebhook(request, options, callback); + } +/** + * Returns details of a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `WorkerPool` to retrieve. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + * @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 [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. + * 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/cloud_build.get_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async + */ + getWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined + ]>; + getWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): void; + getWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): void; + getWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool, + protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getWorkerPool(request, options, callback); + } + +/** + * Starts a build with the specified configuration. + * + * This method returns a long-running `Operation`, which includes the build + * ID. Pass the build ID to `GetBuild` to determine the build status (such as + * `SUCCESS` or `FAILURE`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this build will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {google.devtools.cloudbuild.v1.Build} request.build + * Required. Build resource to create. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + async checkCreateBuildProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBuild, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new build based on the specified build. + * + * This method creates a new build using the original build request, which may + * or may not result in an identical build. + * + * For triggered builds: + * + * * Triggered builds resolve to a precise revision; therefore a retry of a + * triggered build will result in a build that uses the same revision. + * + * For non-triggered builds that specify `RepoSource`: + * + * * If the original build built from the tip of a branch, the retried build + * will build from the tip of that branch, which may not be the same revision + * as the original build. + * * If the original build specified a commit sha or revision ID, the retried + * build will use the identical source. + * + * For builds that specify `StorageSource`: + * + * * If the original build pulled source from Google Cloud Storage without + * specifying the generation of the object, the new build will use the current + * object, which may be different from the original build source. + * * If the original build pulled source from Cloud Storage and specified the + * generation of the object, the new build will attempt to use the same + * object, which may or may not be available depending on the bucket's + * lifecycle management settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to retry. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. Build ID of the original build. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'id': request.id || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.retryBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `retryBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + async checkRetryBuildProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.retryBuild, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Approves or rejects a pending build. + * + * If approved, the returned LRO will be analogous to the LRO returned from + * a CreateBuild call. + * + * If rejected, the returned LRO will be immediately done. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the target build. + * For example: "projects/{$project_id}/builds/{$build_id}" + * @param {google.devtools.cloudbuild.v1.ApprovalResult} request.approvalResult + * Approval decision and metadata. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.approve_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async + */ + approveBuild( + request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + approveBuild( + request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + approveBuild( + request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + approveBuild( + request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.approveBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `approveBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.approve_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async + */ + async checkApproveBuildProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.approveBuild, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Runs a `BuildTrigger` at a particular source revision. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to run. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.triggerId + * Required. ID of the trigger. + * @param {google.devtools.cloudbuild.v1.RepoSource} request.source + * Source to build against this trigger. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'trigger_id': request.triggerId || '', + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.runBuildTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runBuildTrigger()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + async checkRunBuildTriggerProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runBuildTrigger, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this worker pool will be created. + * Format: `projects/{project}/locations/{location}`. + * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool + * Required. `WorkerPool` resource to create. + * @param {string} request.workerPoolId + * 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 /{@link 0-9|a-z}-/. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async + */ + createWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createWorkerPool( + request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkerPool( + request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async + */ + async checkCreateWorkerPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createWorkerPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the `WorkerPool` to delete. + * Format: + * `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. + * @param {string} request.etag + * Optional. If this is provided, it must match the server's etag on the + * workerpool for the request to be processed. + * @param {boolean} request.allowMissing + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + async checkDeleteWorkerPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a `WorkerPool`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool + * Required. The `WorkerPool` to update. + * + * The `name` field is used to identify the `WorkerPool` to update. + * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + * @param {google.protobuf.FieldMask} request.updateMask + * A mask specifying which fields in `worker_pool` to update. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.update_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async + */ + updateWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'worker_pool.name': request.workerPool!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.update_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async + */ + async checkUpdateWorkerPoolProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateWorkerPool, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists previously requested builds. + * + * Previously requested builds may still be in-progress, or may have finished + * successfully or unsuccessfully. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/location` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain the results. + * @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 Array of [Build]{@link google.devtools.cloudbuild.v1.Build}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBuildsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBuilds( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild[], + protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse + ]>; + listBuilds( + request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): void; + listBuilds( + request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): void; + listBuilds( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuild>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuild[], + protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listBuilds(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/location` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Build]{@link google.devtools.cloudbuild.v1.Build} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBuildsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBuildsStream( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.createStream( + this.innerApiCalls.listBuilds as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuilds`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/location` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Build]{@link google.devtools.cloudbuild.v1.Build}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.list_builds.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuilds_async + */ + listBuildsAsync( + request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.asyncIterate( + this.innerApiCalls['listBuilds'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists existing `BuildTrigger`s. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in the list. + * @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 Array of [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBuildTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBuildTriggers( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger[], + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse + ]>; + listBuildTriggers( + request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; + listBuildTriggers( + request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; + listBuildTriggers( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IBuildTrigger>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IBuildTrigger[], + protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, + protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listBuildTriggers(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in the list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBuildTriggersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBuildTriggersStream( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.createStream( + this.innerApiCalls.listBuildTriggers as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBuildTriggers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in the list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.list_build_triggers.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async + */ + listBuildTriggersAsync( + request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'project_id': request.projectId || '', + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.asyncIterate( + this.innerApiCalls['listBuildTriggers'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists `WorkerPool`s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @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 Array of [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listWorkerPoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listWorkerPools( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool[], + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse + ]>; + listWorkerPools( + request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; + listWorkerPools( + request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; + listWorkerPools( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, + protos.google.devtools.cloudbuild.v1.IWorkerPool>): + Promise<[ + protos.google.devtools.cloudbuild.v1.IWorkerPool[], + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, + protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listWorkerPools(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listWorkerPoolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listWorkerPoolsStream( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.createStream( + this.innerApiCalls.listWorkerPools as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listWorkerPools`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.list_worker_pools.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async + */ + listWorkerPoolsAsync( + request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.asyncIterate( + this.innerApiCalls['listWorkerPools'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} keyring + * @param {string} key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyring:string,key:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + keyring: keyring, + key: key, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the keyring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the keyring. + */ + matchKeyringFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; + } + + /** + * Parse the key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key. + */ + matchKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectBuild resource name string. + * + * @param {string} project + * @param {string} build + * @returns {string} Resource name string. + */ + projectBuildPath(project:string,build:string) { + return this.pathTemplates.projectBuildPathTemplate.render({ + project: project, + build: build, + }); + } + + /** + * Parse the project from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; + } + + /** + * Parse the build from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; + } + + /** + * Return a fully-qualified projectLocationBuild resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + projectLocationBuildPath(project:string,location:string,build:string) { + return this.pathTemplates.projectLocationBuildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; + } + + /** + * Parse the location from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; + } + + /** + * Parse the build from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; + } + + /** + * Return a fully-qualified projectLocationTrigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectLocationTriggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; + } + + /** + * Parse the location from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; + } + + /** + * Parse the trigger from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; + } + + /** + * Return a fully-qualified projectTrigger resource name string. + * + * @param {string} project + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectTriggerPath(project:string,trigger:string) { + return this.pathTemplates.projectTriggerPathTemplate.render({ + project: project, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; + } + + /** + * Parse the trigger from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; + } + + /** + * Return a fully-qualified secretVersion resource name string. + * + * @param {string} project + * @param {string} secret + * @param {string} version + * @returns {string} Resource name string. + */ + secretVersionPath(project:string,secret:string,version:string) { + return this.pathTemplates.secretVersionPathTemplate.render({ + project: project, + secret: secret, + version: version, + }); + } + + /** + * Parse the project from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; + } + + /** + * Parse the secret from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the secret. + */ + matchSecretFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; + } + + /** + * Parse the version from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; + } + + /** + * Return a fully-qualified serviceAccount resource name string. + * + * @param {string} project + * @param {string} service_account + * @returns {string} Resource name string. + */ + serviceAccountPath(project:string,serviceAccount:string) { + return this.pathTemplates.serviceAccountPathTemplate.render({ + project: project, + service_account: serviceAccount, + }); + } + + /** + * Parse the project from ServiceAccount resource. + * + * @param {string} serviceAccountName + * A fully-qualified path representing ServiceAccount resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceAccountName(serviceAccountName: string) { + return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).project; + } + + /** + * Parse the service_account from ServiceAccount resource. + * + * @param {string} serviceAccountName + * A fully-qualified path representing ServiceAccount resource. + * @returns {string} A string representing the service_account. + */ + matchServiceAccountFromServiceAccountName(serviceAccountName: string) { + return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).service_account; + } + + /** + * Return a fully-qualified subscription resource name string. + * + * @param {string} project + * @param {string} subscription + * @returns {string} Resource name string. + */ + subscriptionPath(project:string,subscription:string) { + return this.pathTemplates.subscriptionPathTemplate.render({ + project: project, + subscription: subscription, + }); + } + + /** + * Parse the project from Subscription resource. + * + * @param {string} subscriptionName + * A fully-qualified path representing Subscription resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubscriptionName(subscriptionName: string) { + return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).project; + } + + /** + * Parse the subscription from Subscription resource. + * + * @param {string} subscriptionName + * A fully-qualified path representing Subscription resource. + * @returns {string} A string representing the subscription. + */ + matchSubscriptionFromSubscriptionName(subscriptionName: string) { + return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).subscription; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project:string,topic:string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project:string,location:string,workerPool:string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.cloudBuildStub && !this._terminated) { + return this.cloudBuildStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/v1/src/v1/cloud_build_client_config.json new file mode 100644 index 0000000..c677cba --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_build_client_config.json @@ -0,0 +1,114 @@ +{ + "interfaces": { + "google.devtools.cloudbuild.v1.CloudBuild": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBuild": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListBuilds": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RetryBuild": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ApproveBuild": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListBuildTriggers": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RunBuildTrigger": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReceiveTriggerWebhook": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkerPool": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListWorkerPools": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json new file mode 100644 index 0000000..ef52257 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/devtools/cloudbuild/v1/cloudbuild.proto" +] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..3322642 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,215 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.cloudbuild.v1", + "libraryPackage": "@google-cloud/cloudbuild", + "services": { + "CloudBuild": { + "clients": { + "grpc": { + "libraryClient": "CloudBuildClient", + "rpcs": { + "GetBuild": { + "methods": [ + "getBuild" + ] + }, + "CancelBuild": { + "methods": [ + "cancelBuild" + ] + }, + "CreateBuildTrigger": { + "methods": [ + "createBuildTrigger" + ] + }, + "GetBuildTrigger": { + "methods": [ + "getBuildTrigger" + ] + }, + "DeleteBuildTrigger": { + "methods": [ + "deleteBuildTrigger" + ] + }, + "UpdateBuildTrigger": { + "methods": [ + "updateBuildTrigger" + ] + }, + "ReceiveTriggerWebhook": { + "methods": [ + "receiveTriggerWebhook" + ] + }, + "GetWorkerPool": { + "methods": [ + "getWorkerPool" + ] + }, + "CreateBuild": { + "methods": [ + "createBuild" + ] + }, + "RetryBuild": { + "methods": [ + "retryBuild" + ] + }, + "ApproveBuild": { + "methods": [ + "approveBuild" + ] + }, + "RunBuildTrigger": { + "methods": [ + "runBuildTrigger" + ] + }, + "CreateWorkerPool": { + "methods": [ + "createWorkerPool" + ] + }, + "DeleteWorkerPool": { + "methods": [ + "deleteWorkerPool" + ] + }, + "UpdateWorkerPool": { + "methods": [ + "updateWorkerPool" + ] + }, + "ListBuilds": { + "methods": [ + "listBuilds", + "listBuildsStream", + "listBuildsAsync" + ] + }, + "ListBuildTriggers": { + "methods": [ + "listBuildTriggers", + "listBuildTriggersStream", + "listBuildTriggersAsync" + ] + }, + "ListWorkerPools": { + "methods": [ + "listWorkerPools", + "listWorkerPoolsStream", + "listWorkerPoolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudBuildClient", + "rpcs": { + "GetBuild": { + "methods": [ + "getBuild" + ] + }, + "CancelBuild": { + "methods": [ + "cancelBuild" + ] + }, + "CreateBuildTrigger": { + "methods": [ + "createBuildTrigger" + ] + }, + "GetBuildTrigger": { + "methods": [ + "getBuildTrigger" + ] + }, + "DeleteBuildTrigger": { + "methods": [ + "deleteBuildTrigger" + ] + }, + "UpdateBuildTrigger": { + "methods": [ + "updateBuildTrigger" + ] + }, + "ReceiveTriggerWebhook": { + "methods": [ + "receiveTriggerWebhook" + ] + }, + "GetWorkerPool": { + "methods": [ + "getWorkerPool" + ] + }, + "CreateBuild": { + "methods": [ + "createBuild" + ] + }, + "RetryBuild": { + "methods": [ + "retryBuild" + ] + }, + "ApproveBuild": { + "methods": [ + "approveBuild" + ] + }, + "RunBuildTrigger": { + "methods": [ + "runBuildTrigger" + ] + }, + "CreateWorkerPool": { + "methods": [ + "createWorkerPool" + ] + }, + "DeleteWorkerPool": { + "methods": [ + "deleteWorkerPool" + ] + }, + "UpdateWorkerPool": { + "methods": [ + "updateWorkerPool" + ] + }, + "ListBuilds": { + "methods": [ + "listBuilds", + "listBuildsStream", + "listBuildsAsync" + ] + }, + "ListBuildTriggers": { + "methods": [ + "listBuildTriggers", + "listBuildTriggersStream", + "listBuildTriggersAsync" + ] + }, + "ListWorkerPools": { + "methods": [ + "listWorkerPools", + "listWorkerPoolsStream", + "listWorkerPoolsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..82733a0 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudBuildClient} from './cloud_build_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..31e01c5 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const cloudbuild = require('@google-cloud/cloudbuild'); + +function main() { + const cloudBuildClient = new cloudbuild.CloudBuildClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..62c1bda --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {CloudBuildClient} from '@google-cloud/cloudbuild'; + +// check that the client class type name can be used +function doStuffWithCloudBuildClient(client: CloudBuildClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const cloudBuildClient = new CloudBuildClient(); + doStuffWithCloudBuildClient(cloudBuildClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts new file mode 100644 index 0000000..a8b2e10 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts @@ -0,0 +1,3244 @@ +// Copyright 2022 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import { describe, it } from 'mocha'; +import * as cloudbuildModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudBuildClient', () => { + it('has servicePath', () => { + const servicePath = cloudbuildModule.v1.CloudBuildClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudbuildModule.v1.CloudBuildClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudbuildModule.v1.CloudBuildClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudbuildModule.v1.CloudBuildClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBuildStub, undefined); + await client.initialize(); + assert(client.cloudBuildStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudBuildStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBuildStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getBuild', () => { + it('invokes getBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); + client.innerApiCalls.getBuild = stubSimpleCall(expectedResponse); + const [response] = await client.getBuild(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); + client.innerApiCalls.getBuild = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBuild( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBuild with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuild(request), expectedError); + assert((client.innerApiCalls.getBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBuild with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBuild(request), expectedError); + }); + }); + + describe('cancelBuild', () => { + it('invokes cancelBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); + client.innerApiCalls.cancelBuild = stubSimpleCall(expectedResponse); + const [response] = await client.cancelBuild(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes cancelBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); + client.innerApiCalls.cancelBuild = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelBuild( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes cancelBuild with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelBuild(request), expectedError); + assert((client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes cancelBuild with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.cancelBuild(request), expectedError); + }); + }); + + describe('createBuildTrigger', () => { + it('invokes createBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.createBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.createBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.createBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBuildTrigger(request), expectedError); + assert((client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); + request.projectId = ''; + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBuildTrigger(request), expectedError); + }); + }); + + describe('getBuildTrigger', () => { + it('invokes getBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.getBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.getBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.getBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuildTrigger(request), expectedError); + assert((client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBuildTrigger(request), expectedError); + }); + }); + + describe('deleteBuildTrigger', () => { + it('invokes deleteBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBuildTrigger( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBuildTrigger(request), expectedError); + assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBuildTrigger(request), expectedError); + }); + }); + + describe('updateBuildTrigger', () => { + it('invokes updateBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.trigger = {}; + request.trigger.resourceName = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.updateBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.updateBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.trigger = {}; + request.trigger.resourceName = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); + client.innerApiCalls.updateBuildTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBuildTrigger( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateBuildTrigger with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.trigger = {}; + request.trigger.resourceName = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBuildTrigger(request), expectedError); + assert((client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBuildTrigger with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.trigger = {}; + request.trigger.resourceName = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBuildTrigger(request), expectedError); + }); + }); + + describe('receiveTriggerWebhook', () => { + it('invokes receiveTriggerWebhook without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); + request.projectId = ''; + request.trigger = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse()); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.receiveTriggerWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes receiveTriggerWebhook without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); + request.projectId = ''; + request.trigger = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse()); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.receiveTriggerWebhook( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes receiveTriggerWebhook with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); + request.projectId = ''; + request.trigger = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.receiveTriggerWebhook(request), expectedError); + assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes receiveTriggerWebhook with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); + request.projectId = ''; + request.trigger = ''; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.receiveTriggerWebhook(request), expectedError); + }); + }); + + describe('getWorkerPool', () => { + it('invokes getWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()); + client.innerApiCalls.getWorkerPool = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkerPool(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()); + client.innerApiCalls.getWorkerPool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkerPool( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getWorkerPool with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkerPool(request), expectedError); + assert((client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getWorkerPool with closed client', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getWorkerPool(request), expectedError); + }); + }); + + describe('createBuild', () => { + it('invokes createBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBuild(request), expectedError); + assert((client.innerApiCalls.createBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBuild(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('retryBuild', () => { + it('invokes retryBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.retryBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.retryBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes retryBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.retryBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.retryBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes retryBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.retryBuild(request), expectedError); + assert((client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes retryBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); + request.projectId = ''; + request.id = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.retryBuild(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRetryBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRetryBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRetryBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRetryBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('approveBuild', () => { + it('invokes approveBuild without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.approveBuild = stubLongRunningCall(expectedResponse); + const [operation] = await client.approveBuild(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes approveBuild without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.approveBuild = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.approveBuild( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes approveBuild with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.approveBuild(request), expectedError); + assert((client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes approveBuild with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.approveBuild(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkApproveBuildProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkApproveBuildProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkApproveBuildProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkApproveBuildProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('runBuildTrigger', () => { + it('invokes runBuildTrigger without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(expectedResponse); + const [operation] = await client.runBuildTrigger(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runBuildTrigger without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runBuildTrigger = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runBuildTrigger( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runBuildTrigger with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runBuildTrigger(request), expectedError); + assert((client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runBuildTrigger with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); + request.projectId = ''; + request.triggerId = ''; + request.name = ''; + const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runBuildTrigger(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRunBuildTriggerProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunBuildTriggerProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunBuildTriggerProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunBuildTriggerProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createWorkerPool', () => { + it('invokes createWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkerPool(request), expectedError); + assert((client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteWorkerPool', () => { + it('invokes deleteWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkerPool(request), expectedError); + assert((client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateWorkerPool', () => { + it('invokes updateWorkerPool without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); + request.workerPool = {}; + request.workerPool.name = ''; + const expectedHeaderRequestParams = "worker_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkerPool(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateWorkerPool without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); + request.workerPool = {}; + request.workerPool.name = ''; + const expectedHeaderRequestParams = "worker_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateWorkerPool = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkerPool( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateWorkerPool with call error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); + request.workerPool = {}; + request.workerPool.name = ''; + const expectedHeaderRequestParams = "worker_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkerPool(request), expectedError); + assert((client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateWorkerPool with LRO error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); + request.workerPool = {}; + request.workerPool.name = ''; + const expectedHeaderRequestParams = "worker_pool.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateWorkerPoolProgress without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkerPoolProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkerPoolProgress with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateWorkerPoolProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listBuilds', () => { + it('invokes listBuilds without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.innerApiCalls.listBuilds = stubSimpleCall(expectedResponse); + const [response] = await client.listBuilds(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBuilds without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.innerApiCalls.listBuilds = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuilds( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBuilds with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuilds(request), expectedError); + assert((client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBuildsStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBuildsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); + assert.strictEqual( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBuildsStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBuildsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); + assert.strictEqual( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBuilds without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), + ]; + client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; + const iterable = client.listBuildsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBuilds with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBuildsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listBuildTriggers', () => { + it('invokes listBuildTriggers without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.innerApiCalls.listBuildTriggers = stubSimpleCall(expectedResponse); + const [response] = await client.listBuildTriggers(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBuildTriggers without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.innerApiCalls.listBuildTriggers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBuildTriggers( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBuildTriggers with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuildTriggers(request), expectedError); + assert((client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBuildTriggersStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBuildTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); + assert.strictEqual( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBuildTriggersStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBuildTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); + assert.strictEqual( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBuildTriggers without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), + ]; + client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; + const iterable = client.listBuildTriggersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBuildTriggers with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); + request.projectId = ''; + request.parent = ''; + const expectedHeaderRequestParams = "project_id=&parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBuildTriggersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listWorkerPools', () => { + it('invokes listWorkerPools without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.innerApiCalls.listWorkerPools = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkerPools(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listWorkerPools without error using callback', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.innerApiCalls.listWorkerPools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkerPools( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listWorkerPools with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkerPools(request), expectedError); + assert((client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listWorkerPoolsStream without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listWorkerPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); + assert.strictEqual( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listWorkerPoolsStream with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkerPoolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); + assert.strictEqual( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWorkerPools without error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), + ]; + client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; + const iterable = client.listWorkerPoolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWorkerPools with error', async () => { + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkerPoolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('cryptoKey', () => { + const fakePath = "/rendered/path/cryptoKey"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + keyring: "keyringValue", + key: "keyValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath("projectValue", "locationValue", "keyringValue", "keyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyringFromCryptoKeyName', () => { + const result = client.matchKeyringFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyringValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchKeyFromCryptoKeyName', () => { + const result = client.matchKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, "keyValue"); + assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectBuild', () => { + const fakePath = "/rendered/path/projectBuild"; + const expectedParameters = { + project: "projectValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectBuildPath', () => { + const result = client.projectBuildPath("projectValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectBuildName', () => { + const result = client.matchProjectFromProjectBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectBuildName', () => { + const result = client.matchBuildFromProjectBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBuild', () => { + const fakePath = "/rendered/path/projectLocationBuild"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBuildPath', () => { + const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBuildName', () => { + const result = client.matchProjectFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBuildName', () => { + const result = client.matchLocationFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectLocationBuildName', () => { + const result = client.matchBuildFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationTrigger', () => { + const fakePath = "/rendered/path/projectLocationTrigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationTriggerPath', () => { + const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationTriggerName', () => { + const result = client.matchProjectFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationTriggerName', () => { + const result = client.matchLocationFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectLocationTriggerName', () => { + const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTrigger', () => { + const fakePath = "/rendered/path/projectTrigger"; + const expectedParameters = { + project: "projectValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTriggerPath', () => { + const result = client.projectTriggerPath("projectValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTriggerName', () => { + const result = client.matchProjectFromProjectTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectTriggerName', () => { + const result = client.matchTriggerFromProjectTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('secretVersion', () => { + const fakePath = "/rendered/path/secretVersion"; + const expectedParameters = { + project: "projectValue", + secret: "secretValue", + version: "versionValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.secretVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.secretVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('secretVersionPath', () => { + const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSecretVersionName', () => { + const result = client.matchProjectFromSecretVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretFromSecretVersionName', () => { + const result = client.matchSecretFromSecretVersionName(fakePath); + assert.strictEqual(result, "secretValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromSecretVersionName', () => { + const result = client.matchVersionFromSecretVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('serviceAccount', () => { + const fakePath = "/rendered/path/serviceAccount"; + const expectedParameters = { + project: "projectValue", + service_account: "serviceAccountValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.serviceAccountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.serviceAccountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('serviceAccountPath', () => { + const result = client.serviceAccountPath("projectValue", "serviceAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceAccountName', () => { + const result = client.matchProjectFromServiceAccountName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceAccountFromServiceAccountName', () => { + const result = client.matchServiceAccountFromServiceAccountName(fakePath); + assert.strictEqual(result, "serviceAccountValue"); + assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('subscription', () => { + const fakePath = "/rendered/path/subscription"; + const expectedParameters = { + project: "projectValue", + subscription: "subscriptionValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.subscriptionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.subscriptionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('subscriptionPath', () => { + const result = client.subscriptionPath("projectValue", "subscriptionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.subscriptionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSubscriptionName', () => { + const result = client.matchProjectFromSubscriptionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSubscriptionFromSubscriptionName', () => { + const result = client.matchSubscriptionFromSubscriptionName(fakePath); + assert.strictEqual(result, "subscriptionValue"); + assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.topicPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath("projectValue", "topicValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, "topicValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('workerPool', () => { + const fakePath = "/rendered/path/workerPool"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + worker_pool: "workerPoolValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, "workerPoolValue"); + assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..f667feb --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'CloudBuild', + filename: './cloud-build.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 25e6b7ec12839717cf639f48c27846bb09828793 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 24 May 2022 10:01:14 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../devtools/cloudbuild/v1/cloudbuild.proto | 2142 ----------- .../generated/v1/cloud_build.approve_build.js | 64 - .../generated/v1/cloud_build.cancel_build.js | 68 - .../generated/v1/cloud_build.create_build.js | 69 - .../v1/cloud_build.create_build_trigger.js | 68 - .../v1/cloud_build.create_worker_pool.js | 78 - .../v1/cloud_build.delete_build_trigger.js | 68 - .../v1/cloud_build.delete_worker_pool.js | 76 - .../generated/v1/cloud_build.get_build.js | 68 - .../v1/cloud_build.get_build_trigger.js | 68 - .../v1/cloud_build.get_worker_pool.js | 59 - .../v1/cloud_build.list_build_triggers.js | 73 - .../generated/v1/cloud_build.list_builds.js | 82 - .../v1/cloud_build.list_worker_pools.js | 71 - .../v1/cloud_build.receive_trigger_webhook.js | 74 - .../generated/v1/cloud_build.retry_build.js | 69 - .../v1/cloud_build.run_build_trigger.js | 73 - .../v1/cloud_build.update_build_trigger.js | 68 - .../v1/cloud_build.update_worker_pool.js | 70 - ...etadata.google.devtools.cloudbuild.v1.json | 899 ----- owl-bot-staging/v1/src/index.ts | 25 - .../v1/src/v1/cloud_build_client.ts | 2878 --------------- .../v1/src/v1/cloud_build_client_config.json | 114 - .../v1/src/v1/cloud_build_proto_list.json | 3 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 215 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_cloud_build_v1.ts | 3244 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/v1/cloud_build_client.ts | 8 + test/gapic_cloud_build_v1.ts | 87 +- 43 files changed, 69 insertions(+), 11237 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_build_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/cloud_build_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/cloud_build_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_cloud_build_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 773c8c4..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/cloudbuild', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 1e997be..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 6a8e81f..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/cloudbuild", - "version": "0.1.0", - "description": "Cloudbuild client for Node.js", - "repository": "googleapis/nodejs-cloudbuild", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google cloudbuild", - "cloudbuild", - "cloud build" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto deleted file mode 100644 index 3f980c7..0000000 --- a/owl-bot-staging/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ /dev/null @@ -1,2142 +0,0 @@ -// 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. - -syntax = "proto3"; - -package google.devtools.cloudbuild.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.CloudBuild.V1"; -option go_package = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild"; -option java_multiple_files = true; -option java_package = "com.google.cloudbuild.v1"; -option objc_class_prefix = "GCB"; -option ruby_package = "Google::Cloud::Build::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "iam.googleapis.com/ServiceAccount" - pattern: "projects/{project}/serviceAccounts/{service_account}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/Secret" - pattern: "projects/{project}/secrets/{secret}" -}; -option (google.api.resource_definition) = { - type: "secretmanager.googleapis.com/SecretVersion" - pattern: "projects/{project}/secrets/{secret}/versions/{version}" -}; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Subscription" - pattern: "projects/{project}/subscriptions/{subscription}" -}; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Creates and manages builds on Google Cloud Platform. -// -// The main concept used by this API is a `Build`, which describes the location -// of the source to build, how to build the source, and where to store the -// built artifacts, if any. -// -// A user can list previously-requested builds or get builds by their ID to -// determine the status of the build. -service CloudBuild { - option (google.api.default_host) = "cloudbuild.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Starts a build with the specified configuration. - // - // This method returns a long-running `Operation`, which includes the build - // ID. Pass the build ID to `GetBuild` to determine the build status (such as - // `SUCCESS` or `FAILURE`). - rpc CreateBuild(CreateBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds" - body: "build" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/builds" - body: "build" - } - }; - option (google.api.method_signature) = "project_id,build"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Returns information about a previously requested build. - // - // The `Build` that is returned includes its status (such as `SUCCESS`, - // `FAILURE`, or `WORKING`), and timing information. - rpc GetBuild(GetBuildRequest) returns (Build) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds/{id}" - additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Lists previously requested builds. - // - // Previously requested builds may still be in-progress, or may have finished - // successfully or unsuccessfully. - rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds" - additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } - }; - option (google.api.method_signature) = "project_id,filter"; - } - - // Cancels a build in progress. - rpc CancelBuild(CancelBuildRequest) returns (Build) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:cancel" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Creates a new build based on the specified build. - // - // This method creates a new build using the original build request, which may - // or may not result in an identical build. - // - // For triggered builds: - // - // * Triggered builds resolve to a precise revision; therefore a retry of a - // triggered build will result in a build that uses the same revision. - // - // For non-triggered builds that specify `RepoSource`: - // - // * If the original build built from the tip of a branch, the retried build - // will build from the tip of that branch, which may not be the same revision - // as the original build. - // * If the original build specified a commit sha or revision ID, the retried - // build will use the identical source. - // - // For builds that specify `StorageSource`: - // - // * If the original build pulled source from Google Cloud Storage without - // specifying the generation of the object, the new build will use the current - // object, which may be different from the original build source. - // * If the original build pulled source from Cloud Storage and specified the - // generation of the object, the new build will attempt to use the same - // object, which may or may not be available depending on the bucket's - // lifecycle management settings. - rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:retry" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:retry" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,id"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Approves or rejects a pending build. - // - // If approved, the returned LRO will be analogous to the LRO returned from - // a CreateBuild call. - // - // If rejected, the returned LRO will be immediately done. - rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/builds/*}:approve" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:approve" - body: "*" - } - }; - option (google.api.method_signature) = "name,approval_result"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Creates a new `BuildTrigger`. - // - // This API is experimental. - rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers" - body: "trigger" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/triggers" - body: "trigger" - } - }; - option (google.api.method_signature) = "project_id,trigger"; - } - - // Returns information about a `BuildTrigger`. - // - // This API is experimental. - rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Lists existing `BuildTrigger`s. - // - // This API is experimental. - rpc ListBuildTriggers(ListBuildTriggersRequest) - returns (ListBuildTriggersResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*}/triggers" - } - }; - option (google.api.method_signature) = "project_id"; - } - - // Deletes a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Updates a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - patch: "/v1/projects/{project_id}/triggers/{trigger_id}" - body: "trigger" - additional_bindings { - patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" - body: "trigger" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,trigger"; - } - - // Runs a `BuildTrigger` at a particular source revision. - rpc RunBuildTrigger(RunBuildTriggerRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" - body: "source" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:run" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,source"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // ReceiveTriggerWebhook [Experimental] is called when the API receives a - // webhook request targeted at a specific trigger. - rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) - returns (ReceiveTriggerWebhookResponse) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" - body: "body" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" - body: "body" - } - }; - } - - // Creates a `WorkerPool`. - rpc CreateWorkerPool(CreateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workerPools" - body: "worker_pool" - }; - option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "CreateWorkerPoolOperationMetadata" - }; - } - - // Returns details of a `WorkerPool`. - rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a `WorkerPool`. - rpc DeleteWorkerPool(DeleteWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteWorkerPoolOperationMetadata" - }; - } - - // Updates a `WorkerPool`. - rpc UpdateWorkerPool(UpdateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" - body: "worker_pool" - }; - option (google.api.method_signature) = "worker_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "UpdateWorkerPoolOperationMetadata" - }; - } - - // Lists `WorkerPool`s. - rpc ListWorkerPools(ListWorkerPoolsRequest) - returns (ListWorkerPoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workerPools" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Specifies a build to retry. -message RetryBuildRequest { - // The name of the `Build` to retry. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Build ID of the original build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies a build trigger to run and the source to use. -message RunBuildTriggerRequest { - // The name of the `Trigger` to run. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the trigger. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Source to build against this trigger. - RepoSource source = 3; -} - -// Location of the source in an archive file in Google Cloud Storage. -message StorageSource { - // Google Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source. - // - // This object must be a gzipped archive file (`.tar.gz`) containing source to - // build. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a Google Cloud Source Repository. -message RepoSource { - // ID of the project that owns the Cloud Source Repository. If omitted, the - // project ID requesting the build is assumed. - string project_id = 1; - - // Name of the Cloud Source Repository. - string repo_name = 2; - - // A revision within the Cloud Source Repository must be specified in - // one of these ways. - oneof revision { - // Regex matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch_name = 3; - - // Regex matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag_name = 4; - - // Explicit commit SHA to build. - string commit_sha = 5; - } - - // Directory, relative to the source root, in which to run the build. - // - // This must be a relative path. If a step's `dir` is specified and is an - // absolute path, this value is ignored for that step's execution. - string dir = 7; - - // Only trigger a build if the revision regex does NOT match the revision - // regex. - bool invert_regex = 8; - - // Substitutions to use in a triggered build. - // Should only be used with RunBuildTrigger - map substitutions = 9; -} - -// Location of the source manifest in Google Cloud Storage. -// This feature is in Preview; see description -// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). -message StorageSourceManifest { - // Google Cloud Storage bucket containing the source manifest (see [Bucket - // Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source manifest. - // - // This object must be a JSON file. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a supported storage service. -message Source { - // Location of source. - oneof source { - // If provided, get the source from this location in Google Cloud Storage. - StorageSource storage_source = 2; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 3; - - // If provided, get the source from this manifest in Google Cloud Storage. - // This feature is in Preview; see description - // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). - StorageSourceManifest storage_source_manifest = 8; - } -} - -// An image built by the pipeline. -message BuiltImage { - // Name used to push the container image to Google Container Registry, as - // presented to `docker push`. - string name = 1; - - // Docker Registry 2.0 digest. - string digest = 3; - - // Output only. Stores timing information for pushing the specified image. - TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A step in the build pipeline. -message BuildStep { - // Required. The name of the container image that will run this particular - // build step. - // - // If the image is available in the host's Docker daemon's cache, it - // will be run directly. If not, the host will attempt to pull the image - // first, using the builder service account's credentials if necessary. - // - // The Docker daemon's cache will already have the latest versions of all of - // the officially supported build steps - // ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). - // The Docker daemon will also have cached many of the layers for some popular - // images, like "ubuntu", "debian", but they will be refreshed at the time you - // attempt to use them. - // - // If you built an image in a previous build step, it will be stored in the - // host's Docker daemon's cache and is available to use as the name for a - // later build step. - string name = 1; - - // A list of environment variable definitions to be used when running a step. - // - // The elements are of the form "KEY=VALUE" for the environment variable "KEY" - // being given the value "VALUE". - repeated string env = 2; - - // A list of arguments that will be presented to the step when it is started. - // - // If the image used to run the step's container has an entrypoint, the `args` - // are used as arguments to that entrypoint. If the image does not define - // an entrypoint, the first element in args is used as the entrypoint, - // and the remainder will be used as arguments. - repeated string args = 3; - - // Working directory to use when running this step's container. - // - // If this value is a relative path, it is relative to the build's working - // directory. If this value is absolute, it may be outside the build's working - // directory, in which case the contents of the path may not be persisted - // across build step executions, unless a `volume` for that path is specified. - // - // If the build specifies a `RepoSource` with `dir` and a step with a `dir`, - // which specifies an absolute path, the `RepoSource` `dir` is ignored for - // the step's execution. - string dir = 4; - - // Unique identifier for this build step, used in `wait_for` to - // reference this build step as a dependency. - string id = 5; - - // The ID(s) of the step(s) that this build step depends on. - // This build step will not start until all the build steps in `wait_for` - // have completed successfully. If `wait_for` is empty, this build step will - // start when all previous build steps in the `Build.Steps` list have - // completed successfully. - repeated string wait_for = 6; - - // Entrypoint to be used instead of the build step image's default entrypoint. - // If unset, the image's default entrypoint is used. - string entrypoint = 7; - - // A list of environment variables which are encrypted using a Cloud Key - // Management Service crypto key. These values must be specified in the - // build's `Secret`. - repeated string secret_env = 8; - - // List of volumes to mount into the build step. - // - // Each volume is created as an empty volume prior to execution of the - // build step. Upon completion of the build, volumes and their contents are - // discarded. - // - // Using a named volume in only one step is not valid as it is indicative - // of a build request with an incorrect configuration. - repeated Volume volumes = 9; - - // Output only. Stores timing information for executing this build step. - TimeSpan timing = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Stores timing information for pulling this build step's - // builder image only. - TimeSpan pull_timing = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Time limit for executing this build step. If not defined, the step has no - // time limit and will be allowed to continue to run until either it completes - // or the build itself times out. - google.protobuf.Duration timeout = 11; - - // Output only. Status of the build step. At this time, build step status is - // only updated on build completion; step status is not updated in real-time - // as the build progresses. - Build.Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A shell script to be executed in the step. - // - // When script is provided, the user cannot specify the entrypoint or args. - string script = 19; -} - -// Volume describes a Docker container volume which is mounted into build steps -// in order to persist files across build step execution. -message Volume { - // Name of the volume to mount. - // - // Volume names must be unique per build step and must be valid names for - // Docker volumes. Each named volume must be used by at least two build steps. - string name = 1; - - // Path at which to mount the volume. - // - // Paths must be absolute and cannot conflict with other volume paths on the - // same build step or with certain reserved volume paths. - string path = 2; -} - -// Artifacts created by the build pipeline. -message Results { - // Container images that were built as a part of the build. - repeated BuiltImage images = 2; - - // List of build step digests, in the order corresponding to build step - // indices. - repeated string build_step_images = 3; - - // Path to the artifact manifest. Only populated when artifacts are uploaded. - string artifact_manifest = 4; - - // Number of artifacts uploaded. Only populated when artifacts are uploaded. - int64 num_artifacts = 5; - - // List of build step outputs, produced by builder images, in the order - // corresponding to build step indices. - // - // [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) - // can produce this output by writing to `$BUILDER_OUTPUT/output`. - // Only the first 4KB of data is stored. - repeated bytes build_step_outputs = 6; - - // Time to push all non-container artifacts. - TimeSpan artifact_timing = 7; -} - -// An artifact that was uploaded during a build. This -// is a single record in the artifact manifest JSON file. -message ArtifactResult { - // The path of an artifact in a Google Cloud Storage bucket, with the - // generation number. For example, - // `gs://mybucket/path/to/output.jar#generation`. - string location = 1; - - // The file hash of the artifact. - repeated FileHashes file_hash = 2; -} - -// A build resource in the Cloud Build API. -// -// At a high level, a `Build` describes where to find source code, how to build -// it (for example, the builder image to run on the source), and where to store -// the built artifacts. -// -// Fields can include the following variables, which will be expanded when the -// build is created: -// -// - $PROJECT_ID: the project ID of the build. -// - $PROJECT_NUMBER: the project number of the build. -// - $BUILD_ID: the autogenerated ID of the build. -// - $REPO_NAME: the source repository name specified by RepoSource. -// - $BRANCH_NAME: the branch name specified by RepoSource. -// - $TAG_NAME: the tag name specified by RepoSource. -// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or -// resolved from the specified branch or tag. -// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. -message Build { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Build" - pattern: "projects/{project}/builds/{build}" - pattern: "projects/{project}/locations/{location}/builds/{build}" - }; - - // A non-fatal problem encountered during the execution of the build. - message Warning { - // The relative importance of this warning. - enum Priority { - // Should not be used. - PRIORITY_UNSPECIFIED = 0; - - // e.g. deprecation warnings and alternative feature highlights. - INFO = 1; - - // e.g. automated detection of possible issues with the build. - WARNING = 2; - - // e.g. alerts that a feature used in the build is pending removal - ALERT = 3; - } - - // Explanation of the warning generated. - string text = 1; - - // The priority for this warning. - Priority priority = 2; - } - - // A fatal problem encountered during the execution of the build. - message FailureInfo { - // The name of a fatal problem encountered during the execution of the - // build. - enum FailureType { - // Type unspecified - FAILURE_TYPE_UNSPECIFIED = 0; - - // Unable to push the image to the repository. - PUSH_FAILED = 1; - - // Final image not found. - PUSH_IMAGE_NOT_FOUND = 2; - - // Unauthorized push of the final image. - PUSH_NOT_AUTHORIZED = 3; - - // Backend logging failures. Should retry. - LOGGING_FAILURE = 4; - - // A build step has failed. - USER_BUILD_STEP = 5; - - // The source fetching has failed. - FETCH_SOURCE_FAILED = 6; - } - - // The name of the failure. - FailureType type = 1; - - // Explains the failure issue in more detail using hard-coded text. - string detail = 2; - } - - // Possible status of a build or build step. - enum Status { - // Status of the build is unknown. - STATUS_UNKNOWN = 0; - - // Build has been created and is pending execution and queuing. It has not - // been queued. - PENDING = 10; - - // Build or step is queued; work has not yet begun. - QUEUED = 1; - - // Build or step is being executed. - WORKING = 2; - - // Build or step finished successfully. - SUCCESS = 3; - - // Build or step failed to complete successfully. - FAILURE = 4; - - // Build or step failed due to an internal cause. - INTERNAL_ERROR = 5; - - // Build or step took longer than was allowed. - TIMEOUT = 6; - - // Build or step was canceled by a user. - CANCELLED = 7; - - // Build was enqueued for longer than the value of `queue_ttl`. - EXPIRED = 9; - } - - // Output only. The 'Build' name with format: - // `projects/{project}/locations/{location}/builds/{build}`, where {build} - // is a unique identifier generated by the service. - string name = 45 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Unique identifier of the build. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the project. - string project_id = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Status of the build. - Status status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Customer-readable message about the current status. - string status_detail = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The location of the source files to build. - Source source = 3; - - // Required. The operations to be performed on the workspace. - repeated BuildStep steps = 11; - - // Output only. Results of the build. - Results results = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to create the build was received. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which execution of the build was started. - google.protobuf.Timestamp start_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which execution of the build was finished. - // - // The difference between finish_time and start_time is the duration of the - // build's execution. - google.protobuf.Timestamp finish_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Amount of time that this build should be allowed to run, to second - // granularity. If this amount of time elapses, work on the build will cease - // and the build status will be `TIMEOUT`. - // - // `timeout` starts ticking from `startTime`. - // - // Default time is ten minutes. - google.protobuf.Duration timeout = 12; - - // A list of images to be pushed upon the successful completion of all build - // steps. - // - // The images are pushed using the builder service account's credentials. - // - // The digests of the pushed images will be stored in the `Build` resource's - // results field. - // - // If any of the images fail to be pushed, the build status is marked - // `FAILURE`. - repeated string images = 13; - - // TTL in queue for this build. If provided and the build is enqueued longer - // than this value, the build will expire and the build status will be - // `EXPIRED`. - // - // The TTL starts ticking from create_time. - google.protobuf.Duration queue_ttl = 40; - - // Artifacts produced by the build that should be uploaded upon - // successful completion of all build steps. - Artifacts artifacts = 37; - - // Google Cloud Storage bucket where logs should be written (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. - string logs_bucket = 19; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ID of the `BuildTrigger` that triggered this build, if it - // was triggered automatically. - string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Special options for this build. - BuildOptions options = 23; - - // Output only. URL to logs for this build in Google Cloud Console. - string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Substitutions data for `Build` resource. - map substitutions = 29; - - // Tags for annotation of a `Build`. These are not docker tags. - repeated string tags = 31; - - // Secrets to decrypt using Cloud Key Management Service. - // Note: Secret Manager is the recommended technique - // for managing sensitive data with Cloud Build. Use `available_secrets` to - // configure builds to access secrets from Secret Manager. For instructions, - // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets - repeated Secret secrets = 32; - - // Output only. Stores timing information for phases of the build. Valid keys - // are: - // - // * BUILD: time to execute all build steps. - // * PUSH: time to push all specified images. - // * FETCHSOURCE: time to fetch source. - // * SETUPBUILD: time to set up build. - // - // If the build does not specify source or images, - // these keys will not be included. - map timing = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes this build's approval configuration, status, - // and result. - BuildApproval approval = 44 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // IAM service account whose credentials will be used at build runtime. - // Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. - // ACCOUNT can be email address or uniqueId of the service account. - // - string service_account = 42 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // Secrets and secret environment variables. - Secrets available_secrets = 47; - - // Output only. Non-fatal problems encountered during the execution of the - // build. - repeated Warning warnings = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains information about the build when status=FAILURE. - FailureInfo failure_info = 51 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Artifacts produced by a build that should be uploaded upon -// successful completion of all build steps. -message Artifacts { - // Files in the workspace to upload to Cloud Storage upon successful - // completion of all build steps. - message ArtifactObjects { - // Cloud Storage bucket and optional object path, in the form - // "gs://bucket/path/to/somewhere/". (see [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - // - // Files in the workspace matching any path pattern will be uploaded to - // Cloud Storage with this location as a prefix. - string location = 1; - - // Path globs used to match files in the build's workspace. - repeated string paths = 2; - - // Output only. Stores timing information for pushing all artifact objects. - TimeSpan timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // A list of images to be pushed upon the successful completion of all build - // steps. - // - // The images will be pushed using the builder service account's credentials. - // - // The digests of the pushed images will be stored in the Build resource's - // results field. - // - // If any of the images fail to be pushed, the build is marked FAILURE. - repeated string images = 1; - - // A list of objects to be uploaded to Cloud Storage upon successful - // completion of all build steps. - // - // Files in the workspace matching specified paths globs will be uploaded to - // the specified Cloud Storage location using the builder service account's - // credentials. - // - // The location and generation of the uploaded objects will be stored in the - // Build resource's results field. - // - // If any objects fail to be pushed, the build is marked FAILURE. - ArtifactObjects objects = 2; -} - -// Start and end times for a build execution phase. -message TimeSpan { - // Start of time span. - google.protobuf.Timestamp start_time = 1; - - // End of time span. - google.protobuf.Timestamp end_time = 2; -} - -// Metadata for build operations. -message BuildOperationMetadata { - // The build that the operation is tracking. - Build build = 1; -} - -// Provenance of the source. Ways to find the original source, or verify that -// some source was used for this build. -message SourceProvenance { - // A copy of the build's `source.storage_source`, if exists, with any - // generations resolved. - StorageSource resolved_storage_source = 3; - - // A copy of the build's `source.repo_source`, if exists, with any - // revisions resolved. - RepoSource resolved_repo_source = 6; - - // A copy of the build's `source.storage_source_manifest`, if exists, with any - // revisions resolved. - // This feature is in Preview. - StorageSourceManifest resolved_storage_source_manifest = 9; - - // Output only. Hash(es) of the build source, which can be used to verify that - // the original source integrity was maintained in the build. Note that - // `FileHashes` will only be populated if `BuildOptions` has requested a - // `SourceProvenanceHash`. - // - // The keys to this map are file paths used as build source and the values - // contain the hash values for those files. - // - // If the build source came in a single package such as a gzipped tarfile - // (`.tar.gz`), the `FileHash` will be for the single path to that file. - map file_hashes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Container message for hashes of byte content of files, used in -// SourceProvenance messages to verify integrity of source input to the build. -message FileHashes { - // Collection of file hashes. - repeated Hash file_hash = 1; -} - -// Container message for hash values. -message Hash { - // Specifies the hash algorithm, if any. - enum HashType { - // No hash requested. - NONE = 0; - - // Use a sha256 hash. - SHA256 = 1; - - // Use a md5 hash. - MD5 = 2; - } - - // The type of hash that was performed. - HashType type = 1; - - // The hash value. - bytes value = 2; -} - -// Secrets and secret environment variables. -message Secrets { - // Secrets in Secret Manager and associated secret environment variable. - repeated SecretManagerSecret secret_manager = 1; - - // Secrets encrypted with KMS key and the associated secret environment - // variable. - repeated InlineSecret inline = 2; -} - -// Pairs a set of secret environment variables mapped to encrypted -// values with the Cloud KMS key to use to decrypt the value. -message InlineSecret { - // Resource name of Cloud KMS crypto key to decrypt the encrypted value. - // In format: projects/*/locations/*/keyRings/*/cryptoKeys/* - string kms_key_name = 1 [(google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - }]; - - // Map of environment variable name to its encrypted value. - // - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. Values can be at most - // 64 KB in size. There can be at most 100 secret values across all of a - // build's secrets. - map env_map = 2; -} - -// Pairs a secret environment variable with a SecretVersion in Secret Manager. -message SecretManagerSecret { - // Resource name of the SecretVersion. In format: - // projects/*/secrets/*/versions/* - string version_name = 1 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // Environment variable name to associate with the secret. - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. - string env = 2; -} - -// Pairs a set of secret environment variables containing encrypted -// values with the Cloud KMS key to use to decrypt the value. -// Note: Use `kmsKeyName` with `available_secrets` instead of using -// `kmsKeyName` with `secret`. For instructions see: -// https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials. -message Secret { - // Cloud KMS key name to use to decrypt these envs. - string kms_key_name = 1; - - // Map of environment variable name to its encrypted value. - // - // Secret environment variables must be unique across all of a build's - // secrets, and must be used by at least one build step. Values can be at most - // 64 KB in size. There can be at most 100 secret values across all of a - // build's secrets. - map secret_env = 3; -} - -// Request to create a new build. -message CreateBuildRequest { - // The parent resource where this build will be created. - // Format: `projects/{project}/locations/{location}` - string parent = 4 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Build resource to create. - Build build = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to get a build. -message GetBuildRequest { - // The name of the `Build` to retrieve. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list builds. -message ListBuildsRequest { - // The parent of the collection of `Builds`. - // Format: `projects/{project}/locations/location` - string parent = 9 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of results to return in the list. - int32 page_size = 2; - - // The page token for the next page of Builds. - // - // If unspecified, the first page of results is returned. - // - // If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - // In this case, the token should be discarded, and pagination should be - // restarted from the first page of results. - // - // See https://google.aip.dev/158 for more. - string page_token = 3; - - // The raw filter text to constrain the results. - string filter = 8; -} - -// Response including listed builds. -message ListBuildsResponse { - // Builds will be sorted by `create_time`, descending. - repeated Build builds = 1; - - // Token to receive the next page of results. - // This will be absent if the end of the response list has been reached. - string next_page_token = 2; -} - -// Request to cancel an ongoing build. -message CancelBuildRequest { - // The name of the `Build` to cancel. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to approve or reject a pending build. -message ApproveBuildRequest { - // Required. Name of the target build. - // For example: "projects/{$project_id}/builds/{$build_id}" - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Approval decision and metadata. - ApprovalResult approval_result = 2; -} - -// BuildApproval describes a build's approval configuration, state, and -// result. -message BuildApproval { - // Specifies the current state of a build's approval. - enum State { - // Default enum type. This should not be used. - STATE_UNSPECIFIED = 0; - - // Build approval is pending. - PENDING = 1; - - // Build approval has been approved. - APPROVED = 2; - - // Build approval has been rejected. - REJECTED = 3; - - // Build was cancelled while it was still pending approval. - CANCELLED = 5; - } - - // Output only. The state of this build's approval. - State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Configuration for manual approval of this build. - ApprovalConfig config = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Result of manual approval for this Build. - ApprovalResult result = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// ApprovalConfig describes configuration for manual approval of a build. -message ApprovalConfig { - // Whether or not approval is needed. If this is set on a build, it will - // become pending when created, and will need to be explicitly approved - // to start. - bool approval_required = 1; -} - -// ApprovalResult describes the decision and associated metadata of a manual -// approval of a build. -message ApprovalResult { - // Specifies whether or not this manual approval result is to approve - // or reject a build. - enum Decision { - // Default enum type. This should not be used. - DECISION_UNSPECIFIED = 0; - - // Build is approved. - APPROVED = 1; - - // Build is rejected. - REJECTED = 2; - } - - // Output only. Email of the user that called the ApproveBuild API to - // approve or reject a build at the time that the API was called. - string approver_account = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the approval decision was made. - google.protobuf.Timestamp approval_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The decision of this manual approval. - Decision decision = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional comment for this manual approval result. - string comment = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An optional URL tied to this manual approval result. This field - // is essentially the same as comment, except that it will be rendered by the - // UI differently. An example use case is a link to an external job that - // approved this Build. - string url = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for an automated build in response to source repository -// changes. -message BuildTrigger { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - plural: "triggers" - singular: "trigger" - pattern: "projects/{project}/triggers/{trigger}" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" - }; - - // The `Trigger` name with format: - // `projects/{project}/locations/{location}/triggers/{trigger}`, where - // {trigger} is a unique identifier generated by the service. - string resource_name = 34; - - // Output only. Unique identifier of the trigger. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Human-readable description of this trigger. - string description = 10; - - // User-assigned name of the trigger. Must be unique within the project. - // Trigger names must meet the following requirements: - // - // + They must contain only alphanumeric characters and dashes. - // + They can be 1-64 characters long. - // + They must begin and end with an alphanumeric character. - string name = 21; - - // Tags for annotation of a `BuildTrigger` - repeated string tags = 19; - - // Template describing the types of source changes to trigger a build. - // - // Branch and tag names in trigger templates are interpreted as regular - // expressions. Any branch or tag change that matches that regular expression - // will trigger a build. - // - // Mutually exclusive with `github`. - RepoSource trigger_template = 7; - - // GitHubEventsConfig describes the configuration of a trigger that creates - // a build whenever a GitHub event is received. - // - // Mutually exclusive with `trigger_template`. - GitHubEventsConfig github = 13; - - // PubsubConfig describes the configuration of a trigger that - // creates a build whenever a Pub/Sub message is published. - PubsubConfig pubsub_config = 29; - - // WebhookConfig describes the configuration of a trigger that - // creates a build whenever a webhook is sent to a trigger's webhook URL. - WebhookConfig webhook_config = 31; - - // Template describing the Build request to make when the trigger is matched. - oneof build_template { - // Autodetect build configuration. The following precedence is used (case - // insensitive): - // - // 1. cloudbuild.yaml - // 2. cloudbuild.yml - // 3. cloudbuild.json - // 4. Dockerfile - // - // Currently only available for GitHub App Triggers. - bool autodetect = 18; - - // Contents of the build template. - Build build = 4; - - // Path, from the source root, to the build configuration file - // (i.e. cloudbuild.yaml). - string filename = 8; - } - - // Output only. Time when the trigger was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If true, the trigger will never automatically execute a build. - bool disabled = 9; - - // Substitutions for Build resource. The keys must match the following - // regular expression: `^_[A-Z0-9_]+$`. - map substitutions = 11; - - // ignored_files and included_files are file glob matches using - // https://golang.org/pkg/path/filepath/#Match extended with support for "**". - // - // If ignored_files and changed files are both empty, then they are - // not used to determine whether or not to trigger a build. - // - // If ignored_files is not empty, then we ignore any files that match - // any of the ignored_file globs. If the change has no files that are - // outside of the ignored_files globs, then we do not trigger a build. - repeated string ignored_files = 15; - - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is empty, then as far as this filter is - // concerned, we should trigger the build. - // - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is not empty, then we make sure that at - // least one of those files matches a included_files glob. If not, - // then we do not trigger a build. - repeated string included_files = 16; - - // Optional. A Common Expression Language string. - string filter = 30 [(google.api.field_behavior) = OPTIONAL]; - - // The service account used for all user-controlled operations including - // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. - // If no service account is set, then the standard Cloud Build service account - // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. - // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` - string service_account = 33 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; -} - -// GitHubEventsConfig describes the configuration of a trigger that creates a -// build whenever a GitHub event is received. -// -// This message is experimental. -message GitHubEventsConfig { - // The installationID that emits the GitHub event. - int64 installation_id = 1 [deprecated = true]; - - // Owner of the repository. For example: The owner for - // https://github.com/googlecloudplatform/cloud-builders is - // "googlecloudplatform". - string owner = 6; - - // Name of the repository. For example: The name for - // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". - string name = 7; - - // Filter describing the types of events to trigger a build. - // Currently supported event types: push, pull_request. - oneof event { - // filter to match changes in pull requests. - PullRequestFilter pull_request = 4; - - // filter to match changes in refs like branches, tags. - PushFilter push = 5; - } -} - -// PubsubConfig describes the configuration of a trigger that -// creates a build whenever a Pub/Sub message is published. -message PubsubConfig { - // Enumerates potential issues with the underlying Pub/Sub subscription - // configuration. - enum State { - // The subscription configuration has not been checked. - STATE_UNSPECIFIED = 0; - - // The Pub/Sub subscription is properly configured. - OK = 1; - - // The subscription has been deleted. - SUBSCRIPTION_DELETED = 2; - - // The topic has been deleted. - TOPIC_DELETED = 3; - - // Some of the subscription's field are misconfigured. - SUBSCRIPTION_MISCONFIGURED = 4; - } - - // Output only. Name of the subscription. Format is - // `projects/{project}/subscriptions/{subscription}`. - string subscription = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // The name of the topic from which this subscription is receiving messages. - // Format is `projects/{project}/topics/{topic}`. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Service account that will make the push request. - string service_account_email = 3 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// WebhookConfig describes the configuration of a trigger that -// creates a build whenever a webhook is sent to a trigger's webhook URL. -message WebhookConfig { - // Enumerates potential issues with the Secret Manager secret provided by the - // user. - enum State { - // The webhook auth configuration not been checked. - STATE_UNSPECIFIED = 0; - - // The auth configuration is properly setup. - OK = 1; - - // The secret provided in auth_method has been deleted. - SECRET_DELETED = 2; - } - - // Auth method specifies how the webhook authenticates with GCP. - oneof auth_method { - // Required. Resource name for the secret required as a URL parameter. - string secret = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - } - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// PullRequestFilter contains filter properties for matching GitHub Pull -// Requests. -message PullRequestFilter { - // Controls behavior of Pull Request comments. - enum CommentControl { - // Do not require comments on Pull Requests before builds are triggered. - COMMENTS_DISABLED = 0; - - // Enforce that repository owners or collaborators must comment on Pull - // Requests before builds are triggered. - COMMENTS_ENABLED = 1; - - // Enforce that repository owners or collaborators must comment on external - // contributors' Pull Requests before builds are triggered. - COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; - } - - // Target refs to match. - // A target ref is the git reference where the pull request will be applied. - oneof git_ref { - // Regex of branches to match. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch = 2; - } - - // Configure builds to run whether a repository owner or collaborator need to - // comment `/gcbrun`. - CommentControl comment_control = 5; - - // If true, branches that do NOT match the git_ref will trigger a build. - bool invert_regex = 6; -} - -// Push contains filter properties for matching GitHub git pushes. -message PushFilter { - // Modified refs to match. - // A modified refs are the refs modified by a git push operation. - oneof git_ref { - // Regexes matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch = 2; - - // Regexes matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag = 3; - } - - // When true, only trigger a build if the revision regex does NOT match the - // git_ref regex. - bool invert_regex = 4; -} - -// Request to create a new `BuildTrigger`. -message CreateBuildTriggerRequest { - // The parent resource where this trigger will be created. - // Format: `projects/{project}/locations/{location}` - string parent = 3 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to configure automatic builds. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to create. - BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Returns the `BuildTrigger` with the specified ID. -message GetBuildTriggerRequest { - // The name of the `Trigger` to retrieve. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list existing `BuildTriggers`. -message ListBuildTriggersRequest { - // The parent of the collection of `Triggers`. - // Format: `projects/{project}/locations/{location}` - string parent = 4 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to list BuildTriggers. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Token to provide to skip to a particular spot in the list. - string page_token = 3; -} - -// Response containing existing `BuildTriggers`. -message ListBuildTriggersResponse { - // `BuildTriggers` for the project, sorted by `create_time` descending. - repeated BuildTrigger triggers = 1; - - // Token to receive the next page of results. - string next_page_token = 2; -} - -// Request to delete a `BuildTrigger`. -message DeleteBuildTriggerRequest { - // The name of the `Trigger` to delete. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to delete. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update an existing `BuildTrigger`. -message UpdateBuildTriggerRequest { - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to update. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to update. - BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Optional arguments to enable specific features of builds. -message BuildOptions { - // Details about how a build should be executed on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - message PoolOption { - // The `WorkerPool` resource to execute the build on. - // You must have `cloudbuild.workerpools.use` on the project hosting the - // WorkerPool. - // - // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} - string name = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - } - - // Specifies the manner in which the build should be verified, if at all. - enum VerifyOption { - // Not a verifiable build. (default) - NOT_VERIFIED = 0; - - // Verified build. - VERIFIED = 1; - } - - // Supported Compute Engine machine types. - // For more information, see [Machine - // types](https://cloud.google.com/compute/docs/machine-types). - enum MachineType { - // Standard machine type. - UNSPECIFIED = 0; - - // Highcpu machine with 8 CPUs. - N1_HIGHCPU_8 = 1; - - // Highcpu machine with 32 CPUs. - N1_HIGHCPU_32 = 2; - - // Highcpu e2 machine with 8 CPUs. - E2_HIGHCPU_8 = 5; - - // Highcpu e2 machine with 32 CPUs. - E2_HIGHCPU_32 = 6; - } - - // Specifies the behavior when there is an error in the substitution checks. - enum SubstitutionOption { - // Fails the build if error in substitutions checks, like missing - // a substitution in the template or in the map. - MUST_MATCH = 0; - - // Do not fail the build if error in substitutions checks. - ALLOW_LOOSE = 1; - } - - // Specifies the behavior when writing build logs to Google Cloud Storage. - enum LogStreamingOption { - // Service may automatically determine build log streaming behavior. - STREAM_DEFAULT = 0; - - // Build logs should be streamed to Google Cloud Storage. - STREAM_ON = 1; - - // Build logs should not be streamed to Google Cloud Storage; they will be - // written when the build is completed. - STREAM_OFF = 2; - } - - // Specifies the logging mode. - enum LoggingMode { - // The service determines the logging mode. The default is `LEGACY`. Do not - // rely on the default logging behavior as it may change in the future. - LOGGING_UNSPECIFIED = 0; - - // Cloud Logging and Cloud Storage logging are enabled. - LEGACY = 1; - - // Only Cloud Storage logging is enabled. - GCS_ONLY = 2; - - // This option is the same as CLOUD_LOGGING_ONLY. - STACKDRIVER_ONLY = 3 [deprecated = true]; - - // Only Cloud Logging is enabled. Note that logs for both the Cloud Console - // UI and Cloud SDK are based on Cloud Storage logs, so neither will provide - // logs if this option is chosen. - CLOUD_LOGGING_ONLY = 5; - - // Turn off all logging. No build logs will be captured. - NONE = 4; - } - - // Requested hash for SourceProvenance. - repeated Hash.HashType source_provenance_hash = 1; - - // Requested verifiability options. - VerifyOption requested_verify_option = 2; - - // Compute Engine machine type on which to run the build. - MachineType machine_type = 3; - - // Requested disk size for the VM that runs the build. Note that this is *NOT* - // "disk free"; some of the space will be used by the operating system and - // build utilities. Also note that this is the minimum disk size that will be - // allocated for the build -- the build may run with a larger disk than - // requested. At present, the maximum disk size is 1000GB; builds that request - // more than the maximum are rejected with an error. - int64 disk_size_gb = 6; - - // Option to specify behavior when there is an error in the substitution - // checks. - // - // NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot - // be overridden in the build configuration file. - SubstitutionOption substitution_option = 4; - - // Option to specify whether or not to apply bash style string - // operations to the substitutions. - // - // NOTE: this is always enabled for triggered builds and cannot be - // overridden in the build configuration file. - bool dynamic_substitutions = 17; - - // Option to define build log streaming behavior to Google Cloud - // Storage. - LogStreamingOption log_streaming_option = 5; - - // This field deprecated; please use `pool.name` instead. - string worker_pool = 7 [deprecated = true]; - - // Optional. Specification for execution on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Option to specify the logging mode, which determines if and where build - // logs are stored. - LoggingMode logging = 11; - - // A list of global environment variable definitions that will exist for all - // build steps in this build. If a variable is defined in both globally and in - // a build step, the variable will use the build step value. - // - // The elements are of the form "KEY=VALUE" for the environment variable "KEY" - // being given the value "VALUE". - repeated string env = 12; - - // A list of global environment variables, which are encrypted using a Cloud - // Key Management Service crypto key. These values must be specified in the - // build's `Secret`. These variables will be available to all build steps - // in this build. - repeated string secret_env = 13; - - // Global list of volumes to mount for ALL build steps - // - // Each volume is created as an empty volume prior to starting the build - // process. Upon completion of the build, volumes and their contents are - // discarded. Global volume names and paths cannot conflict with the volumes - // defined a build step. - // - // Using a global volume in a build with only one step is not valid as - // it is indicative of a build request with an incorrect configuration. - repeated Volume volumes = 14; -} - -// ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by -// the ReceiveTriggerWebhook method. -message ReceiveTriggerWebhookRequest { - // The name of the `ReceiveTriggerWebhook` to retrieve. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 5; - - // HTTP request body. - google.api.HttpBody body = 1; - - // Project in which the specified trigger lives - string project_id = 2; - - // Name of the trigger to run the payload against - string trigger = 3; - - // Secret token used for authorization if an OAuth token isn't provided. - string secret = 4; -} - -// ReceiveTriggerWebhookResponse [Experimental] is the response object for the -// ReceiveTriggerWebhook method. -message ReceiveTriggerWebhookResponse {} - -// Configuration for a `WorkerPool`. -// -// Cloud Build owns and maintains a pool of workers for general use and have no -// access to a project's private network. By default, builds submitted to -// Cloud Build will use a worker from this pool. -// -// If your build needs access to resources on a private network, -// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give -// your builds access to any single VPC network that you -// administer, including any on-prem resources connected to that VPC -// network. For an overview of private pools, see -// [Private pools -// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). -message WorkerPool { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" - plural: "workerPools" - singular: "workerPool" - style: DECLARATIVE_FRIENDLY - }; - - // State of the `WorkerPool`. - enum State { - // State of the `WorkerPool` is unknown. - STATE_UNSPECIFIED = 0; - - // `WorkerPool` is being created. - CREATING = 1; - - // `WorkerPool` is running. - RUNNING = 2; - - // `WorkerPool` is being deleted: cancelling builds and draining workers. - DELETING = 3; - - // `WorkerPool` is deleted. - DELETED = 4; - } - - // Output only. The resource name of the `WorkerPool`, with format - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - // The value of `{worker_pool}` is provided by `worker_pool_id` in - // `CreateWorkerPool` request and the value of `{location}` is determined by - // the endpoint accessed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-specified, human-readable name for the `WorkerPool`. If provided, - // this value must be 1-63 characters. - string display_name = 2; - - // Output only. A unique identifier for the `WorkerPool`. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified annotations. See https://google.aip.dev/128#annotations - // for more details such as format and size limitations. - map annotations = 4; - - // Output only. Time at which the request to create the `WorkerPool` was - // received. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to update the `WorkerPool` was - // received. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to delete the `WorkerPool` was - // received. - google.protobuf.Timestamp delete_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `WorkerPool` state. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Private Pool configuration for the `WorkerPool`. - oneof config { - // Private Pool using a v1 configuration. - PrivatePoolV1Config private_pool_v1_config = 12; - } - - // Output only. Checksum computed by the server. May be sent on update and - // delete requests to ensure that the client has an up-to-date value before - // proceeding. - string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration for a V1 `PrivatePool`. -message PrivatePoolV1Config { - // Defines the configuration to be used for creating workers in - // the pool. - message WorkerConfig { - // Machine type of a worker, such as `e2-medium`. - // See [Worker pool config - // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). - // If left blank, Cloud Build will use a sensible default. - string machine_type = 1; - - // Size of the disk attached to the worker, in GB. - // See [Worker pool config - // file](https://cloud.google.com/build/docs/private-pools/worker-pool-config-file-schema). - // Specify a value of up to 1000. If `0` is specified, Cloud Build will use - // a standard disk size. - int64 disk_size_gb = 2; - } - - // Defines the network configuration for the pool. - message NetworkConfig { - // Defines the egress option for the pool. - enum EgressOption { - // If set, defaults to PUBLIC_EGRESS. - EGRESS_OPTION_UNSPECIFIED = 0; - - // If set, workers are created without any public address, which prevents - // network egress to public IPs unless a network proxy is configured. - NO_PUBLIC_EGRESS = 1; - - // If set, workers are created with a public address which allows for - // public internet egress. - PUBLIC_EGRESS = 2; - } - - // Required. Immutable. The network definition that the workers are peered - // to. If this section is left empty, the workers will be peered to - // `WorkerPool.project_id` on the service producer network. Must be in the - // format `projects/{project}/global/networks/{network}`, where `{project}` - // is a project number, such as `12345`, and `{network}` is the name of a - // VPC network in the project. See - // [Understanding network configuration - // options](https://cloud.google.com/build/docs/private-pools/set-up-private-pool-environment) - string peered_network = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - } - ]; - - // Option to configure network egress for the workers. - EgressOption egress_option = 2; - } - - // Machine configuration for the workers in the pool. - WorkerConfig worker_config = 1; - - // Network configuration for the pool. - NetworkConfig network_config = 2; -} - -// Request to create a new `WorkerPool`. -message CreateWorkerPoolRequest { - // Required. The parent resource where this worker pool will be created. - // Format: `projects/{project}/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. `WorkerPool` resource to create. - WorkerPool worker_pool = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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]-/. - string worker_pool_id = 3 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED - ]; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to get a `WorkerPool` with the specified name. -message GetWorkerPoolRequest { - // Required. The name of the `WorkerPool` to retrieve. - // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - } - ]; -} - -// Request to delete a `WorkerPool`. -message DeleteWorkerPoolRequest { - // Required. The name of the `WorkerPool` to delete. - // Format: - // `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - } - ]; - - // Optional. If this is provided, it must match the server's etag on the - // workerpool for the request to be processed. - string etag = 2; - - // If set to true, and the `WorkerPool` is not found, the request will succeed - // but no action will be taken on the server. - bool allow_missing = 3; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to update a `WorkerPool`. -message UpdateWorkerPoolRequest { - // Required. The `WorkerPool` to update. - // - // The `name` field is used to identify the `WorkerPool` to update. - // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask specifying which fields in `worker_pool` to update. - google.protobuf.FieldMask update_mask = 2; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to list `WorkerPool`s. -message ListWorkerPoolsRequest { - // Required. The parent of the collection of `WorkerPools`. - // Format: `projects/{project}/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of `WorkerPool`s to return. The service may return - // fewer than this value. If omitted, the server will use a sensible default. - int32 page_size = 2; - - // A page token, received from a previous `ListWorkerPools` call. Provide this - // to retrieve the subsequent page. - string page_token = 3; -} - -// Response containing existing `WorkerPools`. -message ListWorkerPoolsResponse { - // `WorkerPools` for the specified project. - repeated WorkerPool worker_pools = 1; - - // Continuation token used to page through large result sets. Provide this - // value in a subsequent ListWorkerPoolsRequest to return the next page of - // results. - string next_page_token = 2; -} - -// Metadata for the `CreateWorkerPool` operation. -message CreateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` to create. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `UpdateWorkerPool` operation. -message UpdateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being updated. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `DeleteWorkerPool` operation. -message DeleteWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being deleted. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js deleted file mode 100644 index a6cafe4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.approve_build.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js deleted file mode 100644 index 8651a09..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.cancel_build.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js deleted file mode 100644 index d6e6d1a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js deleted file mode 100644 index a24230d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_build_trigger.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js deleted file mode 100644 index 7361205..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.create_worker_pool.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js deleted file mode 100644 index 43ff110..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_build_trigger.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'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)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js deleted file mode 100644 index 262eb44..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.delete_worker_pool.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the `WorkerPool` to delete. - * Format: - * `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. - */ - // const name = 'abc123' - /** - * Optional. If this is provided, it must match the server's etag on the - * workerpool for the request to be processed. - */ - // const etag = 'abc123' - /** - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - */ - // const allowMissing = true - /** - * 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 callDeleteWorkerPool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js deleted file mode 100644 index 786456d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, id) { - // [START cloudbuild_v1_generated_CloudBuild_GetBuild_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of the `Build` to retrieve. - * 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 callGetBuild() { - // Construct request - const request = { - projectId, - id, - }; - - // Run request - const response = await cloudbuildClient.getBuild(request); - console.log(response); - } - - callGetBuild(); - // [END cloudbuild_v1_generated_CloudBuild_GetBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js deleted file mode 100644 index cd80fd6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_build_trigger.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, triggerId) { - // [START cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of the `Trigger` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * Required. ID of the project that owns the trigger. - */ - // const projectId = 'abc123' - /** - * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - */ - // const triggerId = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callGetBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - }; - - // Run request - const response = await cloudbuildClient.getBuildTrigger(request); - console.log(response); - } - - callGetBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js deleted file mode 100644 index 91ebfb8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.get_worker_pool.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the `WorkerPool` to retrieve. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callGetWorkerPool() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getWorkerPool(request); - console.log(response); - } - - callGetWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js deleted file mode 100644 index 869efee..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_build_triggers.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId) { - // [START cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. ID of the project for which to list BuildTriggers. - */ - // const projectId = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Token to provide to skip to a particular spot in the list. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListBuildTriggers() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await cloudbuildClient.listBuildTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuildTriggers(); - // [END cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js deleted file mode 100644 index 31ed683..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_builds.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId) { - // [START cloudbuild_v1_generated_CloudBuild_ListBuilds_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/location` - */ - // const parent = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * The page token for the next page of Builds. - * If unspecified, the first page of results is returned. - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * See https://google.aip.dev/158 for more. - */ - // const pageToken = 'abc123' - /** - * The raw filter text to constrain the results. - */ - // const filter = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListBuilds() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = await cloudbuildClient.listBuildsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuilds(); - // [END cloudbuild_v1_generated_CloudBuild_ListBuilds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js deleted file mode 100644 index c549bee..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.list_worker_pools.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - */ - // const parent = 'abc123' - /** - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callListWorkerPools() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listWorkerPoolsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListWorkerPools(); - // [END cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js deleted file mode 100644 index 43900f3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of the `ReceiveTriggerWebhook` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * HTTP request body. - */ - // const body = {} - /** - * Project in which the specified trigger lives - */ - // const projectId = 'abc123' - /** - * Name of the trigger to run the payload against - */ - // const trigger = 'abc123' - /** - * Secret token used for authorization if an OAuth token isn't provided. - */ - // const secret = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callReceiveTriggerWebhook() { - // Construct request - const request = { - }; - - // Run request - const response = await cloudbuildClient.receiveTriggerWebhook(request); - console.log(response); - } - - callReceiveTriggerWebhook(); - // [END cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js deleted file mode 100644 index fb60578..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.retry_build.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, id) { - // [START cloudbuild_v1_generated_CloudBuild_RetryBuild_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of the `Build` to retry. - * Format: `projects/{project}/locations/{location}/builds/{build}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. Build ID of the original build. - */ - // const id = 'abc123' - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callRetryBuild() { - // Construct request - const request = { - projectId, - id, - }; - - // Run request - const [operation] = await cloudbuildClient.retryBuild(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRetryBuild(); - // [END cloudbuild_v1_generated_CloudBuild_RetryBuild_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js deleted file mode 100644 index 0d9714c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.run_build_trigger.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, triggerId) { - // [START cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name of the `Trigger` to run. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - */ - // const name = 'abc123' - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - /** - * Required. ID of the trigger. - */ - // const triggerId = 'abc123' - /** - * Source to build against this trigger. - */ - // const source = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callRunBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - }; - - // Run request - const [operation] = await cloudbuildClient.runBuildTrigger(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js deleted file mode 100644 index b8d56ca..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_build_trigger.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(projectId, triggerId, trigger) { - // [START cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. ID of the project that owns the trigger. - */ - // const projectId = 'abc123' - /** - * Required. ID of the `BuildTrigger` to update. - */ - // const triggerId = 'abc123' - /** - * Required. `BuildTrigger` to update. - */ - // const trigger = {} - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callUpdateBuildTrigger() { - // Construct request - const request = { - projectId, - triggerId, - trigger, - }; - - // Run request - const response = await cloudbuildClient.updateBuildTrigger(request); - console.log(response); - } - - callUpdateBuildTrigger(); - // [END cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js deleted file mode 100644 index 0417f4d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/cloud_build.update_worker_pool.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(workerPool) { - // [START cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `WorkerPool` to update. - * The `name` field is used to identify the `WorkerPool` to update. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const workerPool = {} - /** - * A mask specifying which fields in `worker_pool` to update. - */ - // const updateMask = {} - /** - * 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 callUpdateWorkerPool() { - // Construct request - const request = { - workerPool, - }; - - // Run request - const [operation] = await cloudbuildClient.updateWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json deleted file mode 100644 index 0c089e5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json +++ /dev/null @@ -1,899 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-cloudbuild", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.cloudbuild.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuild_async", - "title": "CloudBuild createBuild Sample", - "origin": "API_DEFINITION", - "description": " Starts a build with the specified configuration. This method returns a long-running `Operation`, which includes the build ID. Pass the build ID to `GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).", - "canonical": true, - "file": "cloud_build.create_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "build", - "type": ".google.devtools.cloudbuild.v1.Build" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuild_async", - "title": "CloudBuild getBuild Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a previously requested build. The `Build` that is returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and timing information.", - "canonical": true, - "file": "cloud_build.get_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.Build", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuilds_async", - "title": "CloudBuild listBuilds Sample", - "origin": "API_DEFINITION", - "description": " Lists previously requested builds. Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.", - "canonical": true, - "file": "cloud_build.list_builds.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuilds", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListBuildsResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListBuilds", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CancelBuild_async", - "title": "CloudBuild cancelBuild Sample", - "origin": "API_DEFINITION", - "description": " Cancels a build in progress.", - "canonical": true, - "file": "cloud_build.cancel_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.Build", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CancelBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_RetryBuild_async", - "title": "CloudBuild retryBuild Sample", - "origin": "API_DEFINITION", - "description": " Creates a new build based on the specified build. This method creates a new build using the original build request, which may or may not result in an identical build. For triggered builds: * Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision. For non-triggered builds that specify `RepoSource`: * If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build. * If the original build specified a commit sha or revision ID, the retried build will use the identical source. For builds that specify `StorageSource`: * If the original build pulled source from Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", - "canonical": true, - "file": "cloud_build.retry_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RetryBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "RetryBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ApproveBuild_async", - "title": "CloudBuild approveBuild Sample", - "origin": "API_DEFINITION", - "description": " Approves or rejects a pending build. If approved, the returned LRO will be analogous to the LRO returned from a CreateBuild call. If rejected, the returned LRO will be immediately done.", - "canonical": true, - "file": "cloud_build.approve_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApproveBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "approval_result", - "type": ".google.devtools.cloudbuild.v1.ApprovalResult" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ApproveBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ApproveBuild", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async", - "title": "CloudBuild createBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Creates a new `BuildTrigger`. This API is experimental.", - "canonical": true, - "file": "cloud_build.create_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": ".google.devtools.cloudbuild.v1.BuildTrigger" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async", - "title": "CloudBuild getBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a `BuildTrigger`. This API is experimental.", - "canonical": true, - "file": "cloud_build.get_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async", - "title": "CloudBuild listBuildTriggers Sample", - "origin": "API_DEFINITION", - "description": " Lists existing `BuildTrigger`s. This API is experimental.", - "canonical": true, - "file": "cloud_build.list_build_triggers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuildTriggers", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListBuildTriggersResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListBuildTriggers", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async", - "title": "CloudBuild deleteBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", - "canonical": true, - "file": "cloud_build.delete_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "DeleteBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async", - "title": "CloudBuild updateBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Updates a `BuildTrigger` by its project ID and trigger ID. This API is experimental.", - "canonical": true, - "file": "cloud_build.update_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": ".google.devtools.cloudbuild.v1.BuildTrigger" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.BuildTrigger", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "UpdateBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async", - "title": "CloudBuild runBuildTrigger Sample", - "origin": "API_DEFINITION", - "description": " Runs a `BuildTrigger` at a particular source revision.", - "canonical": true, - "file": "cloud_build.run_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.devtools.cloudbuild.v1.RepoSource" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "RunBuildTrigger", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async", - "title": "CloudBuild receiveTriggerWebhook Sample", - "origin": "API_DEFINITION", - "description": " ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.", - "canonical": true, - "file": "cloud_build.receive_trigger_webhook.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReceiveTriggerWebhook", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.api.HttpBody" - }, - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "trigger", - "type": "TYPE_STRING" - }, - { - "name": "secret", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ReceiveTriggerWebhook", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ReceiveTriggerWebhook", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async", - "title": "CloudBuild createWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Creates a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.create_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "worker_pool", - "type": ".google.devtools.cloudbuild.v1.WorkerPool" - }, - { - "name": "worker_pool_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "CreateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async", - "title": "CloudBuild getWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Returns details of a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.get_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.WorkerPool", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "GetWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async", - "title": "CloudBuild deleteWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Deletes a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.delete_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "DeleteWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async", - "title": "CloudBuild updateWorkerPool Sample", - "origin": "API_DEFINITION", - "description": " Updates a `WorkerPool`.", - "canonical": true, - "file": "cloud_build.update_worker_pool.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", - "async": true, - "parameters": [ - { - "name": "worker_pool", - "type": ".google.devtools.cloudbuild.v1.WorkerPool" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "UpdateWorkerPool", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - }, - { - "regionTag": "cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async", - "title": "CloudBuild listWorkerPools Sample", - "origin": "API_DEFINITION", - "description": " Lists `WorkerPool`s.", - "canonical": true, - "file": "cloud_build.list_worker_pools.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkerPools", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v1.ListWorkerPoolsResponse", - "client": { - "shortName": "CloudBuildClient", - "fullName": "google.devtools.cloudbuild.v1.CloudBuildClient" - }, - "method": { - "shortName": "ListWorkerPools", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", - "service": { - "shortName": "CloudBuild", - "fullName": "google.devtools.cloudbuild.v1.CloudBuild" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index c4c9b78..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const CloudBuildClient = v1.CloudBuildClient; -type CloudBuildClient = v1.CloudBuildClient; -export {v1, CloudBuildClient}; -export default {v1, CloudBuildClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/v1/src/v1/cloud_build_client.ts deleted file mode 100644 index 7998805..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_build_client.ts +++ /dev/null @@ -1,2878 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/cloud_build_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_build_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Creates and manages builds on Google Cloud Platform. - * - * The main concept used by this API is a `Build`, which describes the location - * of the source to build, how to build the source, and where to store the - * built artifacts, if any. - * - * A user can list previously-requested builds or get builds by their ID to - * determine the status of the build. - * @class - * @memberof v1 - */ -export class CloudBuildClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudBuildStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudBuildClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudBuildClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/builds/{build}' - ), - projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - projectTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/triggers/{trigger}' - ), - secretVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ), - serviceAccountPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/serviceAccounts/{service_account}' - ), - subscriptionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/subscriptions/{subscription}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - workerPoolPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workerPools/{worker_pool}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listBuilds: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'builds'), - listBuildTriggers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), - listWorkerPools: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'workerPools') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const createBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const retryBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const retryBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const approveBuildResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const approveBuildMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const runBuildTriggerResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.Build') as gax.protobuf.Type; - const runBuildTriggerMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.BuildOperationMetadata') as gax.protobuf.Type; - const createWorkerPoolResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; - const createWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.CreateWorkerPoolOperationMetadata') as gax.protobuf.Type; - const deleteWorkerPoolResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.DeleteWorkerPoolOperationMetadata') as gax.protobuf.Type; - const updateWorkerPoolResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.WorkerPool') as gax.protobuf.Type; - const updateWorkerPoolMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v1.UpdateWorkerPoolOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBuildResponse.decode.bind(createBuildResponse), - createBuildMetadata.decode.bind(createBuildMetadata)), - retryBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - retryBuildResponse.decode.bind(retryBuildResponse), - retryBuildMetadata.decode.bind(retryBuildMetadata)), - approveBuild: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - approveBuildResponse.decode.bind(approveBuildResponse), - approveBuildMetadata.decode.bind(approveBuildMetadata)), - runBuildTrigger: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runBuildTriggerResponse.decode.bind(runBuildTriggerResponse), - runBuildTriggerMetadata.decode.bind(runBuildTriggerMetadata)), - createWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createWorkerPoolResponse.decode.bind(createWorkerPoolResponse), - createWorkerPoolMetadata.decode.bind(createWorkerPoolMetadata)), - deleteWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteWorkerPoolResponse.decode.bind(deleteWorkerPoolResponse), - deleteWorkerPoolMetadata.decode.bind(deleteWorkerPoolMetadata)), - updateWorkerPool: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateWorkerPoolResponse.decode.bind(updateWorkerPoolResponse), - updateWorkerPoolMetadata.decode.bind(updateWorkerPoolMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.cloudbuild.v1.CloudBuild', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.cloudBuildStub) { - return this.cloudBuildStub; - } - - // Put together the "service stub" for - // google.devtools.cloudbuild.v1.CloudBuild. - this.cloudBuildStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v1.CloudBuild') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.cloudbuild.v1.CloudBuild, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudBuildStubMethods = - ['createBuild', 'getBuild', 'listBuilds', 'cancelBuild', 'retryBuild', 'approveBuild', 'createBuildTrigger', 'getBuildTrigger', 'listBuildTriggers', 'deleteBuildTrigger', 'updateBuildTrigger', 'runBuildTrigger', 'receiveTriggerWebhook', 'createWorkerPool', 'getWorkerPool', 'deleteWorkerPool', 'updateWorkerPool', 'listWorkerPools']; - for (const methodName of cloudBuildStubMethods) { - const callPromise = this.cloudBuildStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudBuildStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudbuild.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudbuild.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns information about a previously requested build. - * - * The `Build` that is returned includes its status (such as `SUCCESS`, - * `FAILURE`, or `WORKING`), and timing information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to retrieve. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. ID of the build. - * @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 [Build]{@link google.devtools.cloudbuild.v1.Build}. - * 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/cloud_build.get_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuild_async - */ - getBuild( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined - ]>; - getBuild( - request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): void; - getBuild( - request: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): void; - getBuild( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.IGetBuildRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'id': request.id || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getBuild(request, options, callback); - } -/** - * Cancels a build in progress. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to cancel. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. ID of the build. - * @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 [Build]{@link google.devtools.cloudbuild.v1.Build}. - * 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/cloud_build.cancel_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CancelBuild_async - */ - cancelBuild( - request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined - ]>; - cancelBuild( - request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): void; - cancelBuild( - request: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): void; - cancelBuild( - request?: protos.google.devtools.cloudbuild.v1.ICancelBuildRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild, - protos.google.devtools.cloudbuild.v1.ICancelBuildRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'id': request.id || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.cancelBuild(request, options, callback); - } -/** - * Creates a new `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this trigger will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to configure automatic builds. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` to create. - * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. - * 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/cloud_build.create_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuildTrigger_async - */ - createBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined - ]>; - createBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - createBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - createBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createBuildTrigger(request, options, callback); - } -/** - * Returns information about a `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. - * 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/cloud_build.get_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetBuildTrigger_async - */ - getBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined - ]>; - getBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - getBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - getBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IGetBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'trigger_id': request.triggerId || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getBuildTrigger(request, options, callback); - } -/** - * Deletes a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to delete. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to delete. - * @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/cloud_build.delete_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteBuildTrigger_async - */ - deleteBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined - ]>; - deleteBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'trigger_id': request.triggerId || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteBuildTrigger(request, options, callback); - } -/** - * Updates a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to update. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` to update. - * @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 [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. - * 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/cloud_build.update_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateBuildTrigger_async - */ - updateBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined - ]>; - updateBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger, - protos.google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'trigger_id': request.triggerId || '', - 'trigger.resource_name': request.trigger!.resourceName || '', - }); - this.initialize(); - return this.innerApiCalls.updateBuildTrigger(request, options, callback); - } -/** - * ReceiveTriggerWebhook [Experimental] is called when the API receives a - * webhook request targeted at a specific trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `ReceiveTriggerWebhook` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {google.api.HttpBody} request.body - * HTTP request body. - * @param {string} request.projectId - * Project in which the specified trigger lives - * @param {string} request.trigger - * Name of the trigger to run the payload against - * @param {string} request.secret - * Secret token used for authorization if an OAuth token isn't provided. - * @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 [ReceiveTriggerWebhookResponse]{@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse}. - * 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/cloud_build.receive_trigger_webhook.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ReceiveTriggerWebhook_async - */ - receiveTriggerWebhook( - request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined - ]>; - receiveTriggerWebhook( - request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): void; - receiveTriggerWebhook( - request: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): void; - receiveTriggerWebhook( - request?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse, - protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'trigger': request.trigger || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.receiveTriggerWebhook(request, options, callback); - } -/** - * Returns details of a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `WorkerPool` to retrieve. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - * @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 [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. - * 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/cloud_build.get_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_GetWorkerPool_async - */ - getWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined - ]>; - getWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): void; - getWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): void; - getWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool, - protos.google.devtools.cloudbuild.v1.IGetWorkerPoolRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getWorkerPool(request, options, callback); - } - -/** - * Starts a build with the specified configuration. - * - * This method returns a long-running `Operation`, which includes the build - * ID. Pass the build ID to `GetBuild` to determine the build status (such as - * `SUCCESS` or `FAILURE`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this build will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {google.devtools.cloudbuild.v1.Build} request.build - * Required. Build resource to create. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - async checkCreateBuildProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBuild, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new build based on the specified build. - * - * This method creates a new build using the original build request, which may - * or may not result in an identical build. - * - * For triggered builds: - * - * * Triggered builds resolve to a precise revision; therefore a retry of a - * triggered build will result in a build that uses the same revision. - * - * For non-triggered builds that specify `RepoSource`: - * - * * If the original build built from the tip of a branch, the retried build - * will build from the tip of that branch, which may not be the same revision - * as the original build. - * * If the original build specified a commit sha or revision ID, the retried - * build will use the identical source. - * - * For builds that specify `StorageSource`: - * - * * If the original build pulled source from Google Cloud Storage without - * specifying the generation of the object, the new build will use the current - * object, which may be different from the original build source. - * * If the original build pulled source from Cloud Storage and specified the - * generation of the object, the new build will attempt to use the same - * object, which may or may not be available depending on the bucket's - * lifecycle management settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to retry. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. Build ID of the original build. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'id': request.id || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.retryBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `retryBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - async checkRetryBuildProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.retryBuild, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Approves or rejects a pending build. - * - * If approved, the returned LRO will be analogous to the LRO returned from - * a CreateBuild call. - * - * If rejected, the returned LRO will be immediately done. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the target build. - * For example: "projects/{$project_id}/builds/{$build_id}" - * @param {google.devtools.cloudbuild.v1.ApprovalResult} request.approvalResult - * Approval decision and metadata. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.approve_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async - */ - approveBuild( - request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - approveBuild( - request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - approveBuild( - request: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - approveBuild( - request?: protos.google.devtools.cloudbuild.v1.IApproveBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.approveBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `approveBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.approve_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async - */ - async checkApproveBuildProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.approveBuild, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Runs a `BuildTrigger` at a particular source revision. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to run. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.triggerId - * Required. ID of the trigger. - * @param {google.devtools.cloudbuild.v1.RepoSource} request.source - * Source to build against this trigger. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'trigger_id': request.triggerId || '', - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.runBuildTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runBuildTrigger()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - async checkRunBuildTriggerProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runBuildTrigger, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this worker pool will be created. - * Format: `projects/{project}/locations/{location}`. - * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool - * Required. `WorkerPool` resource to create. - * @param {string} request.workerPoolId - * 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 /{@link 0-9|a-z}-/. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async - */ - createWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createWorkerPool( - request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkerPool( - request: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.ICreateWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async - */ - async checkCreateWorkerPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createWorkerPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the `WorkerPool` to delete. - * Format: - * `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`. - * @param {string} request.etag - * Optional. If this is provided, it must match the server's etag on the - * workerpool for the request to be processed. - * @param {boolean} request.allowMissing - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - async checkDeleteWorkerPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a `WorkerPool`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.cloudbuild.v1.WorkerPool} request.workerPool - * Required. The `WorkerPool` to update. - * - * The `name` field is used to identify the `WorkerPool` to update. - * Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask specifying which fields in `worker_pool` to update. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.update_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async - */ - updateWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IUpdateWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'worker_pool.name': request.workerPool!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.update_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async - */ - async checkUpdateWorkerPoolProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateWorkerPool, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists previously requested builds. - * - * Previously requested builds may still be in-progress, or may have finished - * successfully or unsuccessfully. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/location` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain the results. - * @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 Array of [Build]{@link google.devtools.cloudbuild.v1.Build}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBuildsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBuilds( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild[], - protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse - ]>; - listBuilds( - request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): void; - listBuilds( - request: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): void; - listBuilds( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuild>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuild[], - protos.google.devtools.cloudbuild.v1.IListBuildsRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listBuilds(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/location` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Build]{@link google.devtools.cloudbuild.v1.Build} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBuildsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBuildsStream( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.createStream( - this.innerApiCalls.listBuilds as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuilds`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/location` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Build]{@link google.devtools.cloudbuild.v1.Build}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.list_builds.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuilds_async - */ - listBuildsAsync( - request?: protos.google.devtools.cloudbuild.v1.IListBuildsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.asyncIterate( - this.innerApiCalls['listBuilds'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists existing `BuildTrigger`s. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in the list. - * @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 Array of [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBuildTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBuildTriggers( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger[], - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse - ]>; - listBuildTriggers( - request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; - listBuildTriggers( - request: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): void; - listBuildTriggers( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IBuildTrigger>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IBuildTrigger[], - protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest|null, - protos.google.devtools.cloudbuild.v1.IListBuildTriggersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listBuildTriggers(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in the list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBuildTriggersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBuildTriggersStream( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.createStream( - this.innerApiCalls.listBuildTriggers as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuildTriggers`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in the list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [BuildTrigger]{@link google.devtools.cloudbuild.v1.BuildTrigger}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.list_build_triggers.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListBuildTriggers_async - */ - listBuildTriggersAsync( - request?: protos.google.devtools.cloudbuild.v1.IListBuildTriggersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'project_id': request.projectId || '', - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.asyncIterate( - this.innerApiCalls['listBuildTriggers'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists `WorkerPool`s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @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 Array of [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listWorkerPoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listWorkerPools( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool[], - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse - ]>; - listWorkerPools( - request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; - listWorkerPools( - request: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): void; - listWorkerPools( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse|null|undefined, - protos.google.devtools.cloudbuild.v1.IWorkerPool>): - Promise<[ - protos.google.devtools.cloudbuild.v1.IWorkerPool[], - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest|null, - protos.google.devtools.cloudbuild.v1.IListWorkerPoolsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listWorkerPools(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listWorkerPoolsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listWorkerPoolsStream( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.createStream( - this.innerApiCalls.listWorkerPools as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listWorkerPools`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [WorkerPool]{@link google.devtools.cloudbuild.v1.WorkerPool}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.list_worker_pools.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ListWorkerPools_async - */ - listWorkerPoolsAsync( - request?: protos.google.devtools.cloudbuild.v1.IListWorkerPoolsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.asyncIterate( - this.innerApiCalls['listWorkerPools'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} keyring - * @param {string} key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyring:string,key:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - keyring: keyring, - key: key, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the keyring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the keyring. - */ - matchKeyringFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; - } - - /** - * Parse the key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key. - */ - matchKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectBuild resource name string. - * - * @param {string} project - * @param {string} build - * @returns {string} Resource name string. - */ - projectBuildPath(project:string,build:string) { - return this.pathTemplates.projectBuildPathTemplate.render({ - project: project, - build: build, - }); - } - - /** - * Parse the project from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; - } - - /** - * Parse the build from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; - } - - /** - * Return a fully-qualified projectLocationBuild resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - projectLocationBuildPath(project:string,location:string,build:string) { - return this.pathTemplates.projectLocationBuildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; - } - - /** - * Parse the location from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; - } - - /** - * Parse the build from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; - } - - /** - * Return a fully-qualified projectLocationTrigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectLocationTriggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; - } - - /** - * Parse the location from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; - } - - /** - * Parse the trigger from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; - } - - /** - * Return a fully-qualified projectTrigger resource name string. - * - * @param {string} project - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectTriggerPath(project:string,trigger:string) { - return this.pathTemplates.projectTriggerPathTemplate.render({ - project: project, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; - } - - /** - * Parse the trigger from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; - } - - /** - * Return a fully-qualified secretVersion resource name string. - * - * @param {string} project - * @param {string} secret - * @param {string} version - * @returns {string} Resource name string. - */ - secretVersionPath(project:string,secret:string,version:string) { - return this.pathTemplates.secretVersionPathTemplate.render({ - project: project, - secret: secret, - version: version, - }); - } - - /** - * Parse the project from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; - } - - /** - * Parse the secret from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the secret. - */ - matchSecretFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; - } - - /** - * Parse the version from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).version; - } - - /** - * Return a fully-qualified serviceAccount resource name string. - * - * @param {string} project - * @param {string} service_account - * @returns {string} Resource name string. - */ - serviceAccountPath(project:string,serviceAccount:string) { - return this.pathTemplates.serviceAccountPathTemplate.render({ - project: project, - service_account: serviceAccount, - }); - } - - /** - * Parse the project from ServiceAccount resource. - * - * @param {string} serviceAccountName - * A fully-qualified path representing ServiceAccount resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).project; - } - - /** - * Parse the service_account from ServiceAccount resource. - * - * @param {string} serviceAccountName - * A fully-qualified path representing ServiceAccount resource. - * @returns {string} A string representing the service_account. - */ - matchServiceAccountFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).service_account; - } - - /** - * Return a fully-qualified subscription resource name string. - * - * @param {string} project - * @param {string} subscription - * @returns {string} Resource name string. - */ - subscriptionPath(project:string,subscription:string) { - return this.pathTemplates.subscriptionPathTemplate.render({ - project: project, - subscription: subscription, - }); - } - - /** - * Parse the project from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).project; - } - - /** - * Parse the subscription from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the subscription. - */ - matchSubscriptionFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName).subscription; - } - - /** - * Return a fully-qualified topic resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - topicPath(project:string,topic:string) { - return this.pathTemplates.topicPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).project; - } - - /** - * Parse the topic from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).topic; - } - - /** - * Return a fully-qualified workerPool resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} worker_pool - * @returns {string} Resource name string. - */ - workerPoolPath(project:string,location:string,workerPool:string) { - return this.pathTemplates.workerPoolPathTemplate.render({ - project: project, - location: location, - worker_pool: workerPool, - }); - } - - /** - * Parse the project from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the project. - */ - matchProjectFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).project; - } - - /** - * Parse the location from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the location. - */ - matchLocationFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).location; - } - - /** - * Parse the worker_pool from WorkerPool resource. - * - * @param {string} workerPoolName - * A fully-qualified path representing WorkerPool resource. - * @returns {string} A string representing the worker_pool. - */ - matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { - return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName).worker_pool; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudBuildStub && !this._terminated) { - return this.cloudBuildStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/v1/src/v1/cloud_build_client_config.json deleted file mode 100644 index c677cba..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_build_client_config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "interfaces": { - "google.devtools.cloudbuild.v1.CloudBuild": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBuild": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListBuilds": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CancelBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RetryBuild": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApproveBuild": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListBuildTriggers": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunBuildTrigger": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReceiveTriggerWebhook": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateWorkerPool": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListWorkerPools": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json deleted file mode 100644 index ef52257..0000000 --- a/owl-bot-staging/v1/src/v1/cloud_build_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/devtools/cloudbuild/v1/cloudbuild.proto" -] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 3322642..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.cloudbuild.v1", - "libraryPackage": "@google-cloud/cloudbuild", - "services": { - "CloudBuild": { - "clients": { - "grpc": { - "libraryClient": "CloudBuildClient", - "rpcs": { - "GetBuild": { - "methods": [ - "getBuild" - ] - }, - "CancelBuild": { - "methods": [ - "cancelBuild" - ] - }, - "CreateBuildTrigger": { - "methods": [ - "createBuildTrigger" - ] - }, - "GetBuildTrigger": { - "methods": [ - "getBuildTrigger" - ] - }, - "DeleteBuildTrigger": { - "methods": [ - "deleteBuildTrigger" - ] - }, - "UpdateBuildTrigger": { - "methods": [ - "updateBuildTrigger" - ] - }, - "ReceiveTriggerWebhook": { - "methods": [ - "receiveTriggerWebhook" - ] - }, - "GetWorkerPool": { - "methods": [ - "getWorkerPool" - ] - }, - "CreateBuild": { - "methods": [ - "createBuild" - ] - }, - "RetryBuild": { - "methods": [ - "retryBuild" - ] - }, - "ApproveBuild": { - "methods": [ - "approveBuild" - ] - }, - "RunBuildTrigger": { - "methods": [ - "runBuildTrigger" - ] - }, - "CreateWorkerPool": { - "methods": [ - "createWorkerPool" - ] - }, - "DeleteWorkerPool": { - "methods": [ - "deleteWorkerPool" - ] - }, - "UpdateWorkerPool": { - "methods": [ - "updateWorkerPool" - ] - }, - "ListBuilds": { - "methods": [ - "listBuilds", - "listBuildsStream", - "listBuildsAsync" - ] - }, - "ListBuildTriggers": { - "methods": [ - "listBuildTriggers", - "listBuildTriggersStream", - "listBuildTriggersAsync" - ] - }, - "ListWorkerPools": { - "methods": [ - "listWorkerPools", - "listWorkerPoolsStream", - "listWorkerPoolsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "CloudBuildClient", - "rpcs": { - "GetBuild": { - "methods": [ - "getBuild" - ] - }, - "CancelBuild": { - "methods": [ - "cancelBuild" - ] - }, - "CreateBuildTrigger": { - "methods": [ - "createBuildTrigger" - ] - }, - "GetBuildTrigger": { - "methods": [ - "getBuildTrigger" - ] - }, - "DeleteBuildTrigger": { - "methods": [ - "deleteBuildTrigger" - ] - }, - "UpdateBuildTrigger": { - "methods": [ - "updateBuildTrigger" - ] - }, - "ReceiveTriggerWebhook": { - "methods": [ - "receiveTriggerWebhook" - ] - }, - "GetWorkerPool": { - "methods": [ - "getWorkerPool" - ] - }, - "CreateBuild": { - "methods": [ - "createBuild" - ] - }, - "RetryBuild": { - "methods": [ - "retryBuild" - ] - }, - "ApproveBuild": { - "methods": [ - "approveBuild" - ] - }, - "RunBuildTrigger": { - "methods": [ - "runBuildTrigger" - ] - }, - "CreateWorkerPool": { - "methods": [ - "createWorkerPool" - ] - }, - "DeleteWorkerPool": { - "methods": [ - "deleteWorkerPool" - ] - }, - "UpdateWorkerPool": { - "methods": [ - "updateWorkerPool" - ] - }, - "ListBuilds": { - "methods": [ - "listBuilds", - "listBuildsStream", - "listBuildsAsync" - ] - }, - "ListBuildTriggers": { - "methods": [ - "listBuildTriggers", - "listBuildTriggersStream", - "listBuildTriggersAsync" - ] - }, - "ListWorkerPools": { - "methods": [ - "listWorkerPools", - "listWorkerPoolsStream", - "listWorkerPoolsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 82733a0..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {CloudBuildClient} from './cloud_build_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 31e01c5..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const cloudbuild = require('@google-cloud/cloudbuild'); - -function main() { - const cloudBuildClient = new cloudbuild.CloudBuildClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 62c1bda..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {CloudBuildClient} from '@google-cloud/cloudbuild'; - -// check that the client class type name can be used -function doStuffWithCloudBuildClient(client: CloudBuildClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudBuildClient = new CloudBuildClient(); - doStuffWithCloudBuildClient(cloudBuildClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts deleted file mode 100644 index a8b2e10..0000000 --- a/owl-bot-staging/v1/test/gapic_cloud_build_v1.ts +++ /dev/null @@ -1,3244 +0,0 @@ -// Copyright 2022 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as cloudbuildModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.CloudBuildClient', () => { - it('has servicePath', () => { - const servicePath = cloudbuildModule.v1.CloudBuildClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudbuildModule.v1.CloudBuildClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudbuildModule.v1.CloudBuildClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudbuildModule.v1.CloudBuildClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBuildStub, undefined); - await client.initialize(); - assert(client.cloudBuildStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.cloudBuildStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBuildStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('getBuild', () => { - it('invokes getBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); - client.innerApiCalls.getBuild = stubSimpleCall(expectedResponse); - const [response] = await client.getBuild(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); - client.innerApiCalls.getBuild = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBuild( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBuild with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuild(request), expectedError); - assert((client.innerApiCalls.getBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBuild with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBuild(request), expectedError); - }); - }); - - describe('cancelBuild', () => { - it('invokes cancelBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); - client.innerApiCalls.cancelBuild = stubSimpleCall(expectedResponse); - const [response] = await client.cancelBuild(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes cancelBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()); - client.innerApiCalls.cancelBuild = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelBuild( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes cancelBuild with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelBuild(request), expectedError); - assert((client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes cancelBuild with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CancelBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.cancelBuild(request), expectedError); - }); - }); - - describe('createBuildTrigger', () => { - it('invokes createBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.createBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.createBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.createBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBuildTrigger(request), expectedError); - assert((client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest()); - request.projectId = ''; - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBuildTrigger(request), expectedError); - }); - }); - - describe('getBuildTrigger', () => { - it('invokes getBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.getBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.getBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuildTrigger(request), expectedError); - assert((client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBuildTrigger(request), expectedError); - }); - }); - - describe('deleteBuildTrigger', () => { - it('invokes deleteBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBuildTrigger( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBuildTrigger(request), expectedError); - assert((client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBuildTrigger(request), expectedError); - }); - }); - - describe('updateBuildTrigger', () => { - it('invokes updateBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.trigger = {}; - request.trigger.resourceName = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.updateBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.updateBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.trigger = {}; - request.trigger.resourceName = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()); - client.innerApiCalls.updateBuildTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBuildTrigger( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBuildTrigger with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.trigger = {}; - request.trigger.resourceName = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&trigger.resource_name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBuildTrigger(request), expectedError); - assert((client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBuildTrigger with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.trigger = {}; - request.trigger.resourceName = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBuildTrigger(request), expectedError); - }); - }); - - describe('receiveTriggerWebhook', () => { - it('invokes receiveTriggerWebhook without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); - request.projectId = ''; - request.trigger = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse()); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(expectedResponse); - const [response] = await client.receiveTriggerWebhook(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes receiveTriggerWebhook without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); - request.projectId = ''; - request.trigger = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse()); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.receiveTriggerWebhook( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes receiveTriggerWebhook with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); - request.projectId = ''; - request.trigger = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.receiveTriggerWebhook(request), expectedError); - assert((client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes receiveTriggerWebhook with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest()); - request.projectId = ''; - request.trigger = ''; - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.receiveTriggerWebhook(request), expectedError); - }); - }); - - describe('getWorkerPool', () => { - it('invokes getWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()); - client.innerApiCalls.getWorkerPool = stubSimpleCall(expectedResponse); - const [response] = await client.getWorkerPool(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()); - client.innerApiCalls.getWorkerPool = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getWorkerPool( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getWorkerPool with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkerPool(request), expectedError); - assert((client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getWorkerPool with closed client', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.GetWorkerPoolRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getWorkerPool(request), expectedError); - }); - }); - - describe('createBuild', () => { - it('invokes createBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBuild(request), expectedError); - assert((client.innerApiCalls.createBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateBuildRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBuild(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('retryBuild', () => { - it('invokes retryBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.retryBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.retryBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes retryBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.retryBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.retryBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes retryBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.retryBuild(request), expectedError); - assert((client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes retryBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RetryBuildRequest()); - request.projectId = ''; - request.id = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.retryBuild(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRetryBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRetryBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRetryBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRetryBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('approveBuild', () => { - it('invokes approveBuild without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.approveBuild = stubLongRunningCall(expectedResponse); - const [operation] = await client.approveBuild(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes approveBuild without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.approveBuild = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.approveBuild( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes approveBuild with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.approveBuild(request), expectedError); - assert((client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes approveBuild with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ApproveBuildRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.approveBuild(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkApproveBuildProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkApproveBuildProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkApproveBuildProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkApproveBuildProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('runBuildTrigger', () => { - it('invokes runBuildTrigger without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(expectedResponse); - const [operation] = await client.runBuildTrigger(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runBuildTrigger without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runBuildTrigger = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runBuildTrigger( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runBuildTrigger with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runBuildTrigger(request), expectedError); - assert((client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runBuildTrigger with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest()); - request.projectId = ''; - request.triggerId = ''; - request.name = ''; - const expectedHeaderRequestParams = "project_id=&trigger_id=&name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runBuildTrigger(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRunBuildTriggerProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunBuildTriggerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunBuildTriggerProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunBuildTriggerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createWorkerPool', () => { - it('invokes createWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.createWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkerPool(request), expectedError); - assert((client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteWorkerPool', () => { - it('invokes deleteWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkerPool(request), expectedError); - assert((client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateWorkerPool', () => { - it('invokes updateWorkerPool without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); - request.workerPool = {}; - request.workerPool.name = ''; - const expectedHeaderRequestParams = "worker_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateWorkerPool(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateWorkerPool without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); - request.workerPool = {}; - request.workerPool.name = ''; - const expectedHeaderRequestParams = "worker_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateWorkerPool = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateWorkerPool( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateWorkerPool with call error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); - request.workerPool = {}; - request.workerPool.name = ''; - const expectedHeaderRequestParams = "worker_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkerPool(request), expectedError); - assert((client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateWorkerPool with LRO error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest()); - request.workerPool = {}; - request.workerPool.name = ''; - const expectedHeaderRequestParams = "worker_pool.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateWorkerPoolProgress without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateWorkerPoolProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateWorkerPoolProgress with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateWorkerPoolProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuilds', () => { - it('invokes listBuilds without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.innerApiCalls.listBuilds = stubSimpleCall(expectedResponse); - const [response] = await client.listBuilds(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBuilds without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.innerApiCalls.listBuilds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuilds( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuild[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBuilds with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuilds(request), expectedError); - assert((client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBuildsStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBuildsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); - assert.strictEqual( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBuildsStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBuilds.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBuildsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.Build[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.Build) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuilds, request)); - assert.strictEqual( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBuilds without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.Build()), - ]; - client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; - const iterable = client.listBuildsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBuilds with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildsRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBuilds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBuildsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IBuild[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listBuildTriggers', () => { - it('invokes listBuildTriggers without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.innerApiCalls.listBuildTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listBuildTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBuildTriggers without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.innerApiCalls.listBuildTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuildTriggers( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IBuildTrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBuildTriggers with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuildTriggers(request), expectedError); - assert((client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBuildTriggersStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBuildTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); - assert.strictEqual( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBuildTriggersStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBuildTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBuildTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.BuildTrigger[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.BuildTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuildTriggers, request)); - assert.strictEqual( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBuildTriggers without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.BuildTrigger()), - ]; - client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; - const iterable = client.listBuildTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBuildTriggers with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListBuildTriggersRequest()); - request.projectId = ''; - request.parent = ''; - const expectedHeaderRequestParams = "project_id=&parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBuildTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBuildTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IBuildTrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listWorkerPools', () => { - it('invokes listWorkerPools without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.innerApiCalls.listWorkerPools = stubSimpleCall(expectedResponse); - const [response] = await client.listWorkerPools(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listWorkerPools without error using callback', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.innerApiCalls.listWorkerPools = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listWorkerPools( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v1.IWorkerPool[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listWorkerPools with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkerPools(request), expectedError); - assert((client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listWorkerPoolsStream without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listWorkerPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); - assert.strictEqual( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listWorkerPoolsStream with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listWorkerPools.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listWorkerPoolsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v1.WorkerPool[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v1.WorkerPool) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listWorkerPools, request)); - assert.strictEqual( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listWorkerPools without error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v1.WorkerPool()), - ]; - client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; - const iterable = client.listWorkerPoolsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listWorkerPools with error', async () => { - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listWorkerPools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listWorkerPoolsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v1.IWorkerPool[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('cryptoKey', () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - keyring: "keyringValue", - key: "keyValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyringValue", "keyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyringFromCryptoKeyName', () => { - const result = client.matchKeyringFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyringValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyFromCryptoKeyName', () => { - const result = client.matchKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectBuild', () => { - const fakePath = "/rendered/path/projectBuild"; - const expectedParameters = { - project: "projectValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectBuildPath', () => { - const result = client.projectBuildPath("projectValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectBuildName', () => { - const result = client.matchProjectFromProjectBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectBuildName', () => { - const result = client.matchBuildFromProjectBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBuild', () => { - const fakePath = "/rendered/path/projectLocationBuild"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBuildPath', () => { - const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBuildName', () => { - const result = client.matchProjectFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBuildName', () => { - const result = client.matchLocationFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectLocationBuildName', () => { - const result = client.matchBuildFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationTrigger', () => { - const fakePath = "/rendered/path/projectLocationTrigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationTriggerPath', () => { - const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationTriggerName', () => { - const result = client.matchProjectFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationTriggerName', () => { - const result = client.matchLocationFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectLocationTriggerName', () => { - const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectTrigger', () => { - const fakePath = "/rendered/path/projectTrigger"; - const expectedParameters = { - project: "projectValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectTriggerPath', () => { - const result = client.projectTriggerPath("projectValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectTriggerName', () => { - const result = client.matchProjectFromProjectTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectTriggerName', () => { - const result = client.matchTriggerFromProjectTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('secretVersion', () => { - const fakePath = "/rendered/path/secretVersion"; - const expectedParameters = { - project: "projectValue", - secret: "secretValue", - version: "versionValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.secretVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.secretVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('secretVersionPath', () => { - const result = client.secretVersionPath("projectValue", "secretValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSecretVersionName', () => { - const result = client.matchProjectFromSecretVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretFromSecretVersionName', () => { - const result = client.matchSecretFromSecretVersionName(fakePath); - assert.strictEqual(result, "secretValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromSecretVersionName', () => { - const result = client.matchVersionFromSecretVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('serviceAccount', () => { - const fakePath = "/rendered/path/serviceAccount"; - const expectedParameters = { - project: "projectValue", - service_account: "serviceAccountValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.serviceAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serviceAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serviceAccountPath', () => { - const result = client.serviceAccountPath("projectValue", "serviceAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceAccountName', () => { - const result = client.matchProjectFromServiceAccountName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceAccountFromServiceAccountName', () => { - const result = client.matchServiceAccountFromServiceAccountName(fakePath); - assert.strictEqual(result, "serviceAccountValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('subscription', () => { - const fakePath = "/rendered/path/subscription"; - const expectedParameters = { - project: "projectValue", - subscription: "subscriptionValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.subscriptionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.subscriptionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('subscriptionPath', () => { - const result = client.subscriptionPath("projectValue", "subscriptionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.subscriptionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSubscriptionName', () => { - const result = client.matchProjectFromSubscriptionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSubscriptionFromSubscriptionName', () => { - const result = client.matchSubscriptionFromSubscriptionName(fakePath); - assert.strictEqual(result, "subscriptionValue"); - assert((client.pathTemplates.subscriptionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.topicPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.topicPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('topicPath', () => { - const result = client.topicPath("projectValue", "topicValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.topicPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTopicName', () => { - const result = client.matchProjectFromTopicName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTopicFromTopicName', () => { - const result = client.matchTopicFromTopicName(fakePath); - assert.strictEqual(result, "topicValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('workerPool', () => { - const fakePath = "/rendered/path/workerPool"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - worker_pool: "workerPoolValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.workerPoolPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workerPoolPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workerPoolPath', () => { - const result = client.workerPoolPath("projectValue", "locationValue", "workerPoolValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workerPoolPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkerPoolName', () => { - const result = client.matchProjectFromWorkerPoolName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkerPoolName', () => { - const result = client.matchLocationFromWorkerPoolName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkerPoolFromWorkerPoolName', () => { - const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); - assert.strictEqual(result, "workerPoolValue"); - assert((client.pathTemplates.workerPoolPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index f667feb..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'CloudBuild', - filename: './cloud-build.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/cloud_build_client.ts b/src/v1/cloud_build_client.ts index ca99524..192d02a 100644 --- a/src/v1/cloud_build_client.ts +++ b/src/v1/cloud_build_client.ts @@ -567,6 +567,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + id: request.id || '', name: request.name || '', }); this.initialize(); @@ -664,6 +665,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + id: request.id || '', name: request.name || '', }); this.initialize(); @@ -868,6 +870,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + trigger_id: request.triggerId || '', name: request.name || '', }); this.initialize(); @@ -973,6 +976,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + trigger_id: request.triggerId || '', name: request.name || '', }); this.initialize(); @@ -1077,6 +1081,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + trigger_id: request.triggerId || '', 'trigger.resource_name': request.trigger!.resourceName || '', }); this.initialize(); @@ -1185,6 +1190,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + trigger: request.trigger || '', name: request.name || '', }); this.initialize(); @@ -1560,6 +1566,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + id: request.id || '', name: request.name || '', }); this.initialize(); @@ -1850,6 +1857,7 @@ export class CloudBuildClient { options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ project_id: request.projectId || '', + trigger_id: request.triggerId || '', name: request.name || '', }); this.initialize(); diff --git a/test/gapic_cloud_build_v1.ts b/test/gapic_cloud_build_v1.ts index 31f0cb5..33a131a 100644 --- a/test/gapic_cloud_build_v1.ts +++ b/test/gapic_cloud_build_v1.ts @@ -251,8 +251,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -283,8 +284,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -331,8 +333,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -360,6 +363,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -378,8 +382,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -410,8 +415,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -458,8 +464,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -490,6 +497,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.CancelBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -639,8 +647,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -671,8 +680,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -719,8 +729,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -751,6 +762,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.GetBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -769,8 +781,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -802,8 +815,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -850,8 +864,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -882,6 +897,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -900,9 +916,11 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.trigger = {}; request.trigger.resourceName = ''; - const expectedHeaderRequestParams = 'project_id=&trigger.resource_name='; + const expectedHeaderRequestParams = + 'project_id=&trigger_id=&trigger.resource_name='; const expectedOptions = { otherArgs: { headers: { @@ -934,9 +952,11 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.trigger = {}; request.trigger.resourceName = ''; - const expectedHeaderRequestParams = 'project_id=&trigger.resource_name='; + const expectedHeaderRequestParams = + 'project_id=&trigger_id=&trigger.resource_name='; const expectedOptions = { otherArgs: { headers: { @@ -983,9 +1003,11 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.trigger = {}; request.trigger.resourceName = ''; - const expectedHeaderRequestParams = 'project_id=&trigger.resource_name='; + const expectedHeaderRequestParams = + 'project_id=&trigger_id=&trigger.resource_name='; const expectedOptions = { otherArgs: { headers: { @@ -1016,6 +1038,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.trigger = {}; request.trigger.resourceName = ''; const expectedError = new Error('The client has already been closed.'); @@ -1035,8 +1058,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() ); request.projectId = ''; + request.trigger = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1068,8 +1092,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() ); request.projectId = ''; + request.trigger = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1116,8 +1141,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() ); request.projectId = ''; + request.trigger = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1151,6 +1177,7 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest() ); request.projectId = ''; + request.trigger = ''; request.name = ''; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1492,8 +1519,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1525,8 +1553,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1580,8 +1609,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1612,8 +1642,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RetryBuildRequest() ); request.projectId = ''; + request.id = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1876,8 +1907,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1910,8 +1942,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1965,8 +1998,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: { @@ -1997,8 +2031,9 @@ describe('v1.CloudBuildClient', () => { new protos.google.devtools.cloudbuild.v1.RunBuildTriggerRequest() ); request.projectId = ''; + request.triggerId = ''; request.name = ''; - const expectedHeaderRequestParams = 'project_id=&name='; + const expectedHeaderRequestParams = 'project_id=&trigger_id=&name='; const expectedOptions = { otherArgs: { headers: {