From 59eccd95ee93a35c9e1e4311b45ab8bac1d75dc1 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 21 Jul 2023 20:57:56 +0000 Subject: [PATCH 1/2] feat: add git_file_source and git_repo_source to build_trigger PiperOrigin-RevId: 550012872 Source-Link: https://github.com/googleapis/googleapis/commit/f90d153e275bb611d3c4948a3434a92593fb4589 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7682e231b6058aa439b4b4f6df236240bf88b3e2 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkYnVpbGQvLk93bEJvdC55YW1sIiwiaCI6Ijc2ODJlMjMxYjYwNThhYTQzOWI0YjRmNmRmMjM2MjQwYmY4OGIzZTIifQ== --- .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../google-devtools-cloudbuild/v1/.gitignore | 14 + .../google-devtools-cloudbuild/v1/.jsdoc.js | 55 + .../google-devtools-cloudbuild/v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../google-devtools-cloudbuild/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../v1/package.json | 64 + .../devtools/cloudbuild/v1/cloudbuild.proto | 2720 +++++++++++++ .../generated/v1/cloud_build.approve_build.js | 67 + .../generated/v1/cloud_build.cancel_build.js | 71 + .../generated/v1/cloud_build.create_build.js | 72 + .../v1/cloud_build.create_build_trigger.js | 71 + .../v1/cloud_build.create_worker_pool.js | 81 + .../v1/cloud_build.delete_build_trigger.js | 71 + .../v1/cloud_build.delete_worker_pool.js | 79 + .../generated/v1/cloud_build.get_build.js | 71 + .../v1/cloud_build.get_build_trigger.js | 71 + .../v1/cloud_build.get_worker_pool.js | 62 + .../v1/cloud_build.list_build_triggers.js | 76 + .../generated/v1/cloud_build.list_builds.js | 85 + .../v1/cloud_build.list_worker_pools.js | 74 + .../v1/cloud_build.receive_trigger_webhook.js | 77 + .../generated/v1/cloud_build.retry_build.js | 72 + .../v1/cloud_build.run_build_trigger.js | 77 + .../v1/cloud_build.update_build_trigger.js | 71 + .../v1/cloud_build.update_worker_pool.js | 73 + ...etadata.google.devtools.cloudbuild.v1.json | 899 +++++ .../v1/src/index.ts | 25 + .../v1/src/v1/cloud_build_client.ts | 3328 ++++++++++++++++ .../v1/src/v1/cloud_build_client_config.json | 114 + .../v1/src/v1/cloud_build_proto_list.json | 3 + .../v1/src/v1/gapic_metadata.json | 215 + .../v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_cloud_build_v1.ts | 3520 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v2/.eslintignore | 7 + .../v2/.eslintrc.json | 3 + .../google-devtools-cloudbuild/v2/.gitignore | 14 + .../google-devtools-cloudbuild/v2/.jsdoc.js | 55 + .../google-devtools-cloudbuild/v2/.mocharc.js | 33 + .../v2/.prettierrc.js | 22 + .../google-devtools-cloudbuild/v2/README.md | 1 + .../v2/linkinator.config.json | 16 + .../v2/package.json | 64 + .../devtools/cloudbuild/v2/cloudbuild.proto | 112 + .../devtools/cloudbuild/v2/repositories.proto | 802 ++++ ...itory_manager.batch_create_repositories.js | 70 + .../repository_manager.create_connection.js | 76 + .../repository_manager.create_repository.js | 77 + .../repository_manager.delete_connection.js | 73 + .../repository_manager.delete_repository.js | 73 + .../v2/repository_manager.fetch_git_refs.js | 66 + ...ory_manager.fetch_linkable_repositories.js | 72 + .../v2/repository_manager.fetch_read_token.js | 62 + ...pository_manager.fetch_read_write_token.js | 62 + .../v2/repository_manager.get_connection.js | 62 + .../v2/repository_manager.get_repository.js | 62 + .../v2/repository_manager.list_connections.js | 72 + .../repository_manager.list_repositories.js | 79 + .../repository_manager.update_connection.js | 80 + ...etadata.google.devtools.cloudbuild.v2.json | 655 +++ .../v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 175 + .../v2/src/v2/index.ts | 19 + .../v2/src/v2/repository_manager_client.ts | 2603 ++++++++++++ .../v2/repository_manager_client_config.json | 106 + .../src/v2/repository_manager_proto_list.json | 4 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2/system-test/install.ts | 49 + .../v2/test/gapic_repository_manager_v2.ts | 3384 ++++++++++++++++ .../v2/tsconfig.json | 19 + .../v2/webpack.config.js | 64 + 79 files changed, 21847 insertions(+) create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/README.md create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/package.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/README.md create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/package.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json create mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js new file mode 100644 index 00000000000..09c8e7ac916 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/cloudbuild', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/README.md b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md new file mode 100644 index 00000000000..1e997bef7bc --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md @@ -0,0 +1 @@ +Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/package.json b/owl-bot-staging/google-devtools-cloudbuild/v1/package.json new file mode 100644 index 00000000000..eff88724d8e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/ && minifyProtoJson", + "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": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto new file mode 100644 index 00000000000..b864bed355a --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -0,0 +1,2720 @@ +// Copyright 2023 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/api/routing.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 = "cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_package = "com.google.cloudbuild.v1"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V1"; +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: "gkehub.googleapis.com/Membership" + pattern: "projects/{project}/locations/{location}/memberships/{cluster_name}" +}; +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}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" +}; + +// 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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + 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 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/builds/*" + } + }; + 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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/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.routing) = { + routing_parameters { + field: "trigger.resource_name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,trigger"; + } + + // Runs a `BuildTrigger` at a particular source revision. + // + // To run a regional or global trigger, use the POST request + // that includes the location endpoint in the path (ex. + // v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The + // POST request that does not include the location endpoint in the path can + // only be used when running global triggers. + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/triggers/*" + } + }; + 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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/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.routing) = { + routing_parameters { + field: "name" + path_template: "projects/*/locations/{location=*}/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.routing) = { + routing_parameters { + field: "worker_pool.name" + path_template: "projects/*/locations/{location=*}/workerPools/*" + } + }; + 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.routing) = { + routing_parameters { + field: "parent" + path_template: "projects/*/locations/{location=*}" + } + }; + 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. + // Branch and tag names cannot consist of regular expressions. + RepoSource source = 3; +} + +// Location of the source in an archive file in Cloud Storage. +message StorageSource { + // Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Cloud Storage object containing the source. + // + // This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`) + // containing source to build. + string object = 2; + + // 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 any accessible Git repository. +message GitSource { + // Location of the Git repo to build. + // + // This will be used as a `git remote`, see + // https://git-scm.com/docs/git-remote. + string url = 1; + + // 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 = 5; + + // The revision to fetch from the Git repository such as a branch, a tag, a + // commit SHA, or any Git ref. + // + // Cloud Build uses `git fetch` to fetch the revision from the Git + // repository; therefore make sure that the string you provide for `revision` + // is parsable by the command. For information on string values accepted by + // `git fetch`, see + // https://git-scm.com/docs/gitrevisions#_specifying_revisions. For + // information on `git fetch`, see https://git-scm.com/docs/git-fetch. + string revision = 6; +} + +// 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 Cloud Storage. +// This feature is in Preview; see description +// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). +message StorageSourceManifest { + // Cloud Storage bucket containing the source manifest (see [Bucket + // Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Cloud Storage object containing the source manifest. + // + // This object must be a JSON file. + string object = 2; + + // 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 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 Git repository. + GitSource git_source = 5; + + // If provided, get the source from this manifest in 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]; +} + +// Artifact uploaded using the PythonPackage directive. +message UploadedPythonPackage { + // URI of the uploaded artifact. + string uri = 1; + + // Hash types and values of the Python Artifact. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Maven artifact uploaded using the MavenArtifact directive. +message UploadedMavenArtifact { + // URI of the uploaded artifact. + string uri = 1; + + // Hash types and values of the Maven Artifact. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An npm package uploaded to Artifact Registry using the NpmPackage +// directive. +message UploadedNpmPackage { + // URI of the uploaded npm package. + string uri = 1; + + // Hash types and values of the npm package. + FileHashes file_hashes = 2; + + // Output only. Stores timing information for pushing the specified artifact. + TimeSpan push_timing = 3 [(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]; + + // Allow this build step to fail without failing the entire build. + // + // If false, the entire build will fail if this step fails. Otherwise, the + // build will succeed, but this step will still have a failure status. + // Error information will be reported in the failure_detail field. + bool allow_failure = 14; + + // Output only. Return code from running the step. + int32 exit_code = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allow this build step to fail without failing the entire build if and + // only if the exit code is one of the specified codes. If allow_failure + // is also specified, this field will take precedence. + repeated int32 allow_exit_codes = 18; + + // 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 for non-container artifacts uploaded to Cloud + // Storage. Only populated when artifacts are uploaded to Cloud Storage. + string artifact_manifest = 4; + + // Number of non-container artifacts uploaded to Cloud Storage. Only populated + // when artifacts are uploaded to Cloud Storage. + 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 to Cloud Storage. + TimeSpan artifact_timing = 7; + + // Python artifacts uploaded to Artifact Registry at the end of the build. + repeated UploadedPythonPackage python_packages = 8; + + // Maven artifacts uploaded to Artifact Registry at the end of the build. + repeated UploadedMavenArtifact maven_artifacts = 9; + + // Npm packages uploaded to Artifact Registry at the end of the build. + repeated UploadedNpmPackage npm_packages = 12; +} + +// 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 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. +// - $LOCATION: the location/region 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}" + }; + + // 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; + } + + // 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; + } + + // 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 60 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; + + // 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 artifacts including docker images and non docker + // artifacts. + // * 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 Maven artifact to upload to Artifact Registry upon successful completion + // of all build steps. + message MavenArtifact { + // Artifact Registry repository, in the form + // "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY" + // + // Artifact in the workspace specified by path will be uploaded to + // Artifact Registry with this location as a prefix. + string repository = 1; + + // Path to an artifact in the build's workspace to be uploaded to + // Artifact Registry. + // This can be either an absolute path, + // e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar + // or a relative path from /workspace, + // e.g. my-app/target/my-app-1.0.SNAPSHOT.jar. + string path = 2; + + // Maven `artifactId` value used when uploading the artifact to Artifact + // Registry. + string artifact_id = 3; + + // Maven `groupId` value used when uploading the artifact to Artifact + // Registry. + string group_id = 4; + + // Maven `version` value used when uploading the artifact to Artifact + // Registry. + string version = 5; + } + + // Python package to upload to Artifact Registry upon successful completion + // of all build steps. A package can encapsulate multiple objects to be + // uploaded to a single repository. + message PythonPackage { + // Artifact Registry repository, in the form + // "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY" + // + // Files in the workspace matching any path pattern will be uploaded to + // Artifact Registry with this location as a prefix. + string repository = 1; + + // Path globs used to match files in the build's workspace. For Python/ + // Twine, this is usually `dist/*`, and sometimes additionally an `.asc` + // file. + repeated string paths = 2; + } + + // Npm package to upload to Artifact Registry upon successful completion + // of all build steps. + message NpmPackage { + // Artifact Registry repository, in the form + // "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY" + // + // Npm package in the workspace specified by path will be zipped and + // uploaded to Artifact Registry with this location as a prefix. + string repository = 1; + + // Path to the package.json. + // e.g. workspace/path/to/package + string package_path = 2; + } + + // 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; + + // A list of Maven artifacts to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // Artifacts in the workspace matching specified paths globs will be uploaded + // to the specified Artifact Registry repository using the builder service + // account's credentials. + // + // If any artifacts fail to be pushed, the build is marked FAILURE. + repeated MavenArtifact maven_artifacts = 3; + + // A list of Python packages to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // The build service account credentials will be used to perform the upload. + // + // If any objects fail to be pushed, the build is marked FAILURE. + repeated PythonPackage python_packages = 5; + + // A list of npm packages to be uploaded to Artifact Registry upon + // successful completion of all build steps. + // + // Npm packages in the specified paths will be uploaded + // to the specified Artifact Registry repository using the builder service + // account's credentials. + // + // If any packages fail to be pushed, the build is marked FAILURE. + repeated NpmPackage npm_packages = 6; +} + +// 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; + + // Use a sha512 hash. + SHA512 = 4; + } + + // 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]; +} + +// GitRepoSource describes a repo and ref of a code repository. +message GitRepoSource { + // The URI of the repo (e.g. https://github.com/user/repo.git). + // Either `uri` or `repository` can be specified and is required. + string uri = 1; + + // The source of the SCM repo. + oneof source { + // The connected repository resource name, in the format + // `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or + // `repository` can be specified and is required. + string repository = 6 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // The branch or tag to use. Must start with "refs/" (required). + string ref = 2; + + // See RepoType below. + GitFileSource.RepoType repo_type = 3; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + +// GitFileSource describes a file within a (possibly remote) code repository. +message GitFileSource { + // The type of the repo, since it may not be explicit from the `repo` field + // (e.g from a URL). + enum RepoType { + // The default, unknown repo type. Don't use it, instead use one of + // the other repo types. + UNKNOWN = 0; + + // A Google Cloud Source Repositories-hosted repo. + CLOUD_SOURCE_REPOSITORIES = 1; + + // A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub + // Enterprise). + GITHUB = 2; + + // A Bitbucket Server-hosted repo. + BITBUCKET_SERVER = 3; + + // A GitLab-hosted repo. + GITLAB = 4; + } + + // The path of the file, with the repo root as the root of the path. + string path = 1; + + // The URI of the repo. + // Either uri or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string uri = 2; + + // The source of the SCM repo. + oneof source { + // The fully qualified resource name of the Repos API repository. + // Either URI or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string repository = 7 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // See RepoType above. + RepoType repo_type = 3; + + // The branch, tag, arbitrary ref, or SHA version of the repo to use when + // resolving the filename (optional). + // This field respects the same syntax/resolution as described here: + // https://git-scm.com/docs/gitrevisions + // If unspecified, the revision from which the trigger invocation originated + // is assumed to be the revision from which to read the specified path. + string revision = 4; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + +// Configuration for an automated build in response to source repository +// changes. +message BuildTrigger { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + pattern: "projects/{project}/triggers/{trigger}" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + plural: "triggers" + singular: "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. + // At least one of the template fields must be provided. + 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; + + // The file source describing the local or remote Build template. + GitFileSource git_file_source = 24; + } + + // 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 repo and ref of the repository from which to build. This field + // is used only for those triggers that do not respond to SCM events. + // Triggers that respond to such events build source at whatever commit + // caused the event. + // This field is currently only used by Webhook, Pub/Sub, Manual, and Cron + // triggers. + GitRepoSource source_to_build = 26; + + // 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" + }]; + + // The configuration of a trigger that creates a build whenever an event from + // Repo API is received. + RepositoryEventConfig repository_event_config = 39; +} + +// The configuration of a trigger that creates a build whenever an event from +// Repo API is received. +message RepositoryEventConfig { + // All possible SCM repo types from Repo API. + enum RepositoryType { + // If unspecified, RepositoryType defaults to GITHUB. + REPOSITORY_TYPE_UNSPECIFIED = 0; + + // The SCM repo is GITHUB. + GITHUB = 1; + + // The SCM repo is GITHUB Enterprise. + GITHUB_ENTERPRISE = 2; + + // The SCM repo is GITLAB Enterprise. + GITLAB_ENTERPRISE = 3; + } + + // The resource name of the Repo API resource. + string repository = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + + // Output only. The type of the SCM vendor the repository points to. + RepositoryType repository_type = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The types of filter to trigger a build. + oneof filter { + // Filter to match changes in pull requests. + PullRequestFilter pull_request = 3; + + // Filter to match changes in refs like branches, tags. + PushFilter push = 4; + } +} + +// GitHubEventsConfig describes the configuration of a trigger that creates a +// build whenever a GitHub event is received. +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 { + // Specifies the manner in which the build should be verified, if at all. + // + // If a verified build is requested, and any part of the process to generate + // and upload provenance fails, the build will also fail. + // + // If the build does not request verification then that process may occur, but + // is not guaranteed to. If it does occur and fails, the build will not fail. + // + // For more information, see [Viewing Build + // Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance). + enum VerifyOption { + // Not a verifiable build (the default). + NOT_VERIFIED = 0; + + // Build must be verified. + 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; + + // E2 machine with 1 CPU. + E2_MEDIUM = 7; + } + + // 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 Cloud Storage. + enum LogStreamingOption { + // Service may automatically determine build log streaming behavior. + STREAM_DEFAULT = 0; + + // Build logs should be streamed to Cloud Storage. + STREAM_ON = 1; + + // Build logs should not be streamed to Cloud Storage; they will be + // written when the build is completed. + STREAM_OFF = 2; + } + + // 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 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; + + // Build logs are stored in Cloud Logging and Cloud Storage. + LEGACY = 1; + + // Build logs are stored in Cloud Storage. + GCS_ONLY = 2; + + // This option is the same as CLOUD_LOGGING_ONLY. + STACKDRIVER_ONLY = 3 [deprecated = true]; + + // Build logs are stored in Cloud Logging. Selecting this option will not + // allow [logs + // streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log). + CLOUD_LOGGING_ONLY = 5; + + // Turn off all logging. No build logs will be captured. + NONE = 4; + } + + // Default GCS log bucket behavior options. + enum DefaultLogsBucketBehavior { + // Unspecified. + DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED = 0; + + // Bucket is located in user-owned project in the same region as the + // build. The builder service account must have access to create and write + // to GCS buckets in the build project. + REGIONAL_USER_OWNED_BUCKET = 1; + } + + // 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 2000GB; 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 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; + + // Optional. Option to specify how default logs buckets are setup. + DefaultLogsBucketBehavior default_logs_bucket_behavior = 21 + [(google.api.field_behavior) = OPTIONAL]; +} + +// 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 {} + +message GitHubEnterpriseConfig { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + pattern: "projects/{project}/githubEnterpriseConfigs/{config}" + pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" + }; + + // Optional. The full resource name for the GitHubEnterpriseConfig + // For example: + // "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}" + string name = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The URL of the github enterprise host the configuration is for. + string host_url = 3; + + // Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise + // server. + int64 app_id = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Time when the installation was associated with the project. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The key that should be attached to webhook calls to the ReceiveWebhook + // endpoint. + string webhook_key = 8; + + // Optional. The network to be used when reaching out to the GitHub + // Enterprise server. The VPC network must be enabled for private + // service connection. This should be set if the GitHub Enterprise server is + // hosted on-premises and not reachable by public internet. + // If this field is left empty, no network peering will occur and calls to + // the GitHub Enterprise server will be made over the public internet. + // Must be in the format + // `projects/{project}/global/networks/{network}`, where {project} + // is a project number or id and {network} is the name of a + // VPC network in the project. + string peered_network = 9 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Names of secrets in Secret Manager. + GitHubEnterpriseSecrets secrets = 10; + + // Name to display for this config. + string display_name = 11; + + // Optional. SSL certificate to use for requests to GitHub Enterprise. + string ssl_ca = 12 [(google.api.field_behavior) = OPTIONAL]; +} + +// GitHubEnterpriseSecrets represents the names of all necessary secrets in +// Secret Manager for a GitHub Enterprise server. +// Format is: projects//secrets/. +message GitHubEnterpriseSecrets { + // The resource name for the private key secret version. + string private_key_version_name = 5 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the webhook secret secret version in Secret Manager. + string webhook_secret_version_name = 6 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth secret secret version in Secret Manager. + string oauth_secret_version_name = 7 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth client ID secret version in Secret Manager. + string oauth_client_id_version_name = 8 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; +} + +// 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; + + // `WorkerPool` is being updated; new builds cannot be run. + UPDATING = 5; + } + + // 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]; + + // Configuration for the `WorkerPool`. + oneof config { + // Legacy Private Pool 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 2000. 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; + + // Immutable. Subnet IP range within the peered network. This is specified + // in CIDR notation with a slash and the subnet prefix size. You can + // optionally specify an IP address before the subnet prefix value. e.g. + // `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a + // prefix size of 29 bits. + // `/16` would specify a prefix size of 16 bits, with an automatically + // determined IP within the peered VPC. + // If unspecified, a value of `/24` will be used. + string peered_network_ip_range = 3 + [(google.api.field_behavior) = IMMUTABLE]; + } + + // 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/{location}/workerPools/{workerPool}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + } + ]; + + // Optional. If provided, it must match the server's etag on the workerpool + // for the request to be processed. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js new file mode 100644 index 00000000000..8b0d3fb6a27 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js @@ -0,0 +1,67 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js new file mode 100644 index 00000000000..db4b5cc4a2b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js new file mode 100644 index 00000000000..4b5eaf08a32 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js @@ -0,0 +1,72 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js new file mode 100644 index 00000000000..4ecc084fa67 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js new file mode 100644 index 00000000000..d06ff8cb64c --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js @@ -0,0 +1,81 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js new file mode 100644 index 00000000000..716af8a093d --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js new file mode 100644 index 00000000000..9475c1af929 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js @@ -0,0 +1,79 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the `WorkerPool` to delete. + * Format: + * `projects/{project}/locations/{location}/workerPools/{workerPool}`. + */ + // const name = 'abc123' + /** + * Optional. If 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js new file mode 100644 index 00000000000..4a51363d4b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js new file mode 100644 index 00000000000..6a2d62f21b6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js new file mode 100644 index 00000000000..03a02cb42b7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js @@ -0,0 +1,62 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js new file mode 100644 index 00000000000..973a4f720fd --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js @@ -0,0 +1,76 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js new file mode 100644 index 00000000000..a19245f4d07 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js @@ -0,0 +1,85 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js new file mode 100644 index 00000000000..51cbd24e9fb --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js @@ -0,0 +1,74 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js new file mode 100644 index 00000000000..11ca471ed4e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js @@ -0,0 +1,77 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js new file mode 100644 index 00000000000..7a3341c3944 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js @@ -0,0 +1,72 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js new file mode 100644 index 00000000000..5ea555bab67 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js @@ -0,0 +1,77 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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. + * Branch and tag names cannot consist of regular expressions. + */ + // 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js new file mode 100644 index 00000000000..ebccd60ca2d --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js @@ -0,0 +1,71 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js new file mode 100644 index 00000000000..5a07273017c --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js @@ -0,0 +1,73 @@ +// Copyright 2023 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json new file mode 100644 index 00000000000..6e529400fb2 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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": 64, + "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": 63, + "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": 77, + "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": 63, + "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 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": 64, + "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": 59, + "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": 63, + "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": 63, + "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": 68, + "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": 63, + "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": 63, + "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. To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.", + "canonical": true, + "file": "cloud_build.run_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "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": 69, + "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": 73, + "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": 54, + "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": 71, + "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": 65, + "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": 66, + "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/google-devtools-cloudbuild/v1/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts new file mode 100644 index 00000000000..68941b8a880 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts new file mode 100644 index 00000000000..10565979b75 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts @@ -0,0 +1,3328 @@ +// Copyright 2023 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CloudBuildClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/builds/{build}' + ), + projectConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/githubEnterpriseConfigs/{config}' + ), + projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + projectLocationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}' + ), + projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + projectTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/triggers/{trigger}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' + ), + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=operations/**}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/**}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.protobuf.Empty | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.trigger?.resourceName; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse | 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' + ] = this._gaxModule.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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBuild, this._gaxModule.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 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.retryBuild, this._gaxModule.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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.approveBuild, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Runs a `BuildTrigger` at a particular source revision. + * + * To run a regional or global trigger, use the POST request + * that includes the location endpoint in the path (ex. + * v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The + * POST request that does not include the location endpoint in the path can + * only be used when running global triggers. + * + * @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. + * Branch and tag names cannot consist of regular expressions. + * @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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runBuildTrigger, this._gaxModule.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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkerPool, this._gaxModule.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/{location}/workerPools/{workerPool}`. + * @param {string} [request.etag] + * Optional. If 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, this._gaxModule.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 || {}; + let routingParameter = {}; + { + const fieldValue = request.workerPool?.name; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkerPool, this._gaxModule.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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.createStream( + this.innerApiCalls.listBuilds as 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 + * {@link google.devtools.cloudbuild.v1.Build | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {}, + 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.createStream( + this.innerApiCalls.listBuildTriggers as 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 + * {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {}, + 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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.createStream( + this.innerApiCalls.listWorkerPools as 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 + * {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; + let routingParameter = {}; + { + const fieldValue = request.parent; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); + if (match) { + const parameterValue = match.groups?.['location'] ?? fieldValue; + Object.assign(routingParameter, { location: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); + 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 {}, + 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 network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * 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 projectConfig resource name string. + * + * @param {string} project + * @param {string} config + * @returns {string} Resource name string. + */ + projectConfigPath(project:string,config:string) { + return this.pathTemplates.projectConfigPathTemplate.render({ + project: project, + config: config, + }); + } + + /** + * Parse the project from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).project; + } + + /** + * Parse the config from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).config; + } + + /** + * 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 projectLocationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} config + * @returns {string} Resource name string. + */ + projectLocationConfigPath(project:string,location:string,config:string) { + return this.pathTemplates.projectLocationConfigPathTemplate.render({ + project: project, + location: location, + config: config, + }); + } + + /** + * Parse the project from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).project; + } + + /** + * Parse the location from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).location; + } + + /** + * Parse the config from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).config; + } + + /** + * 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,connection:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + connection: connection, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the connection from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * 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/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json new file mode 100644 index 00000000000..c677cba6cb7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json new file mode 100644 index 00000000000..ef522572f3b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..33226421337 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts new file mode 100644 index 00000000000..f01e5acb61b --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..21a069f2aec --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9d43cef7252 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts new file mode 100644 index 00000000000..e3376f4a516 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts @@ -0,0 +1,3520 @@ +// Copyright 2023 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancelBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBuildTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + 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.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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.trigger = {}; + // path template: projects/*/locations/{location=*}/triggers/* + request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + 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); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + 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); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; + const expectedError = new Error('expected'); + client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.receiveTriggerWebhook(request), expectedError); + const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); + request.trigger = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); + request.name = defaultValue3; + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.retryBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.retryBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.approveBuild(request), expectedError); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/builds/* + request.name = 'projects/value/locations/value/builds/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.approveBuild(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runBuildTrigger(request), expectedError); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/triggers/* + request.name = 'projects/value/locations/value/triggers/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runBuildTrigger(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*}/workerPools/* + request.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + 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); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateWorkerPool(request), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 = {}; + // path template: projects/*/locations/{location=*}/workerPools/* + request.workerPool.name = 'projects/value/locations/value/workerPools/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateWorkerPool(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuilds(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuilds.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuilds.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBuildTriggers(request), expectedError); + const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuildTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value';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); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listWorkerPools(request), expectedError); + const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listWorkerPools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + // path template: projects/*/locations/{location=*} + request.parent = 'projects/value/locations/value'; + const expectedHeaderRequestParams = 'location=value'; + 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( + (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.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('projectConfig', () => { + const fakePath = "/rendered/path/projectConfig"; + const expectedParameters = { + project: "projectValue", + config: "configValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConfigPath', () => { + const result = client.projectConfigPath("projectValue", "configValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConfigName', () => { + const result = client.matchProjectFromProjectConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConfigFromProjectConfigName', () => { + const result = client.matchConfigFromProjectConfigName(fakePath); + assert.strictEqual(result, "configValue"); + assert((client.pathTemplates.projectConfigPathTemplate.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('projectLocationConfig', () => { + const fakePath = "/rendered/path/projectLocationConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + config: "configValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConfigPath', () => { + const result = client.projectLocationConfigPath("projectValue", "locationValue", "configValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConfigName', () => { + const result = client.matchProjectFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConfigName', () => { + const result = client.matchLocationFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConfigFromProjectLocationConfigName', () => { + const result = client.matchConfigFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, "configValue"); + assert((client.pathTemplates.projectLocationConfigPathTemplate.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('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection: "connectionValue", + repository: "repositoryValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "connectionValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionFromRepositoryName', () => { + const result = client.matchConnectionFromRepositoryName(fakePath); + assert.strictEqual(result, "connectionValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.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/google-devtools-cloudbuild/v1/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js new file mode 100644 index 00000000000..f667feb1580 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/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', +}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.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/google-devtools-cloudbuild/v2/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js new file mode 100644 index 00000000000..09c8e7ac916 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 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 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/cloudbuild', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v2/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v2/README.md b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md new file mode 100644 index 00000000000..1e997bef7bc --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md @@ -0,0 +1 @@ +Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/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/google-devtools-cloudbuild/v2/package.json b/owl-bot-staging/google-devtools-cloudbuild/v2/package.json new file mode 100644 index 00000000000..39238c28b76 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/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", + "repository manager" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "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": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto new file mode 100644 index 00000000000..8a2fb350d39 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto @@ -0,0 +1,112 @@ +// 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 +// +// 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.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.CloudBuild.V2"; +option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudBuildProto"; +option java_package = "com.google.cloudbuild.v2"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V2"; +option ruby_package = "Google::Cloud::Build::V2"; +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: "cloudbuild.googleapis.com/githubEnterpriseConfig" + pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" +}; + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents the custom metadata of the RunWorkflow long-running operation. +message RunWorkflowCustomOperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ID of the pipeline run created by RunWorkflow. + string pipeline_run_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto new file mode 100644 index 00000000000..41583e70d4e --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto @@ -0,0 +1,802 @@ +// Copyright 2023 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.v2; + +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/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.CloudBuild.V2"; +option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; +option java_multiple_files = true; +option java_outer_classname = "RepositoryManagerProto"; +option java_package = "com.google.cloudbuild.v2"; +option objc_class_prefix = "GCB"; +option php_namespace = "Google\\Cloud\\Build\\V2"; +option ruby_package = "Google::Cloud::Build::V2"; +option (google.api.resource_definition) = { + type: "servicedirectory.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" +}; + +// Manages connections to source code repositories. +service RepositoryManager { + option (google.api.default_host) = "cloudbuild.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Connection. + rpc CreateConnection(CreateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/connections" + body: "connection" + }; + option (google.api.method_signature) = "parent,connection,connection_id"; + option (google.longrunning.operation_info) = { + response_type: "Connection" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Gets details of a single connection. + rpc GetConnection(GetConnectionRequest) returns (Connection) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/connections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Connections in a given project and location. + rpc ListConnections(ListConnectionsRequest) + returns (ListConnectionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/connections" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a single connection. + rpc UpdateConnection(UpdateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{connection.name=projects/*/locations/*/connections/*}" + body: "connection" + }; + option (google.api.method_signature) = "connection,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Connection" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Deletes a single connection. + rpc DeleteConnection(DeleteConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/connections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Creates a Repository. + rpc CreateRepository(CreateRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" + body: "repository" + }; + option (google.api.method_signature) = "parent,repository,repository_id"; + option (google.longrunning.operation_info) = { + response_type: "Repository" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Creates multiple repositories inside a connection. + rpc BatchCreateRepositories(BatchCreateRepositoriesRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories:batchCreate" + body: "*" + }; + option (google.api.method_signature) = "parent,requests"; + option (google.longrunning.operation_info) = { + response_type: "BatchCreateRepositoriesResponse" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Gets details of a single repository. + rpc GetRepository(GetRepositoryRequest) returns (Repository) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Repositories in a given connection. + rpc ListRepositories(ListRepositoriesRequest) + returns (ListRepositoriesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a single repository. + rpc DeleteRepository(DeleteRepositoryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" + }; + } + + // Fetches read/write token of a given repository. + rpc FetchReadWriteToken(FetchReadWriteTokenRequest) + returns (FetchReadWriteTokenResponse) { + option (google.api.http) = { + post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadWriteToken" + body: "*" + }; + option (google.api.method_signature) = "repository"; + } + + // Fetches read token of a given repository. + rpc FetchReadToken(FetchReadTokenRequest) returns (FetchReadTokenResponse) { + option (google.api.http) = { + post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadToken" + body: "*" + }; + option (google.api.method_signature) = "repository"; + } + + // FetchLinkableRepositories get repositories from SCM that are + // accessible and could be added to the connection. + rpc FetchLinkableRepositories(FetchLinkableRepositoriesRequest) + returns (FetchLinkableRepositoriesResponse) { + option (google.api.http) = { + get: "/v2/{connection=projects/*/locations/*/connections/*}:fetchLinkableRepositories" + }; + } + + // Fetch the list of branches or tags for a given repository. + rpc FetchGitRefs(FetchGitRefsRequest) returns (FetchGitRefsResponse) { + option (google.api.http) = { + get: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs" + }; + option (google.api.method_signature) = "repository"; + } +} + +// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or +// GitLab. +message Connection { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Connection" + pattern: "projects/{project}/locations/{location}/connections/{connection}" + plural: "connections" + singular: "connection" + style: DECLARATIVE_FRIENDLY + }; + + // Immutable. The resource name of the connection, in the format + // `projects/{project}/locations/{location}/connections/{connection_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. Server assigned timestamp for when the connection was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned timestamp for when the connection was updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for the connection depending on the type of provider. + oneof connection_config { + // Configuration for connections to github.com. + GitHubConfig github_config = 5; + + // Configuration for connections to an instance of GitHub Enterprise. + GitHubEnterpriseConfig github_enterprise_config = 6; + + // Configuration for connections to gitlab.com or an instance of GitLab + // Enterprise. + GitLabConfig gitlab_config = 7; + } + + // Output only. Installation state of the Connection. + InstallationState installation_state = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If disabled is set to true, functionality is disabled for this connection. + // Repository based API methods and webhooks processing for repositories in + // this connection will be disabled. + bool disabled = 13; + + // Output only. Set to true when the connection is being set up or updated in + // the background. + bool reconciling = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to store small amounts of arbitrary data. + map annotations = 15; + + // This checksum is computed by the server based on the value of other + // fields, and may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 16; +} + +// Describes stage and necessary actions to be taken by the +// user to complete the installation. Used for GitHub and GitHub Enterprise +// based connections. +message InstallationState { + // Stage of the installation process. + enum Stage { + // No stage specified. + STAGE_UNSPECIFIED = 0; + + // Only for GitHub Enterprise. An App creation has been requested. + // The user needs to confirm the creation in their GitHub enterprise host. + PENDING_CREATE_APP = 1; + + // User needs to authorize the GitHub (or Enterprise) App via OAuth. + PENDING_USER_OAUTH = 2; + + // User needs to follow the link to install the GitHub (or Enterprise) App. + PENDING_INSTALL_APP = 3; + + // Installation process has been completed. + COMPLETE = 10; + } + + // Output only. Current step of the installation process. + Stage stage = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Message of what the user should do next to continue the + // installation. Empty string if the installation is already complete. + string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Link to follow for next action. Empty string if the + // installation is already complete. + string action_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for FetchLinkableRepositories. +message FetchLinkableRepositoriesRequest { + // Required. The name of the Connection. + // Format: `projects/*/locations/*/connections/*`. + string connection = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Number of results to return in the list. Default to 20. + int32 page_size = 2; + + // Page start. + string page_token = 3; +} + +// Response message for FetchLinkableRepositories. +message FetchLinkableRepositoriesResponse { + // repositories ready to be created. + repeated Repository repositories = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Configuration for connections to github.com. +message GitHubConfig { + // OAuth credential of the account that authorized the Cloud Build GitHub App. + // It is recommended to use a robot account instead of a human user account. + // The OAuth token must be tied to the Cloud Build GitHub App. + OAuthCredential authorizer_credential = 1; + + // GitHub App installation id. + int64 app_installation_id = 2; +} + +// Configuration for connections to an instance of GitHub Enterprise. +message GitHubEnterpriseConfig { + // Required. The URI of the GitHub Enterprise host this connection is for. + string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. API Key used for authentication of webhook events. + string api_key = 12 [(google.api.field_behavior) = REQUIRED]; + + // Id of the GitHub App created from the manifest. + int64 app_id = 2; + + // The URL-friendly name of the GitHub App. + string app_slug = 13; + + // SecretManager resource containing the private key of the GitHub App, + // formatted as `projects/*/secrets/*/versions/*`. + string private_key_secret_version = 4 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // SecretManager resource containing the webhook secret of the GitHub App, + // formatted as `projects/*/secrets/*/versions/*`. + string webhook_secret_secret_version = 5 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // ID of the installation of the GitHub App. + int64 app_installation_id = 9; + + // Configuration for using Service Directory to privately connect to a GitHub + // Enterprise server. This should only be set if the GitHub Enterprise server + // is hosted on-premises and not reachable by public internet. If this field + // is left empty, calls to the GitHub Enterprise server will be made over the + // public internet. + ServiceDirectoryConfig service_directory_config = 10; + + // SSL certificate to use for requests to GitHub Enterprise. + string ssl_ca = 11; + + // Output only. GitHub Enterprise version installed at the host_uri. + string server_version = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for connections to gitlab.com or an instance of GitLab +// Enterprise. +message GitLabConfig { + // The URI of the GitLab Enterprise host this connection is for. + // If not specified, the default value is https://gitlab.com. + string host_uri = 1; + + // Required. Immutable. SecretManager resource containing the webhook secret + // of a GitLab Enterprise project, formatted as + // `projects/*/secrets/*/versions/*`. + string webhook_secret_secret_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Required. A GitLab personal access token with the minimum `read_api` scope + // access. + UserCredential read_authorizer_credential = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. A GitLab personal access token with the `api` scope access. + UserCredential authorizer_credential = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Configuration for using Service Directory to privately connect to a GitLab + // Enterprise server. This should only be set if the GitLab Enterprise server + // is hosted on-premises and not reachable by public internet. If this field + // is left empty, calls to the GitLab Enterprise server will be made over the + // public internet. + ServiceDirectoryConfig service_directory_config = 5; + + // SSL certificate to use for requests to GitLab Enterprise. + string ssl_ca = 6; + + // Output only. Version of the GitLab Enterprise server running on the + // `host_uri`. + string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ServiceDirectoryConfig represents Service Directory configuration for a +// connection. +message ServiceDirectoryConfig { + // Required. The Service Directory service name. + // Format: + // projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; +} + +// A repository associated to a parent connection. +message Repository { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" + plural: "repositories" + singular: "repository" + style: DECLARATIVE_FRIENDLY + }; + + // Immutable. Resource name of the repository, in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Git Clone HTTPS URI. + string remote_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server assigned timestamp for when the connection was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned timestamp for when the connection was updated. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Allows clients to store small amounts of arbitrary data. + map annotations = 6; + + // This checksum is computed by the server based on the value of other + // fields, and may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + string etag = 7; + + // Output only. External ID of the webhook created for the repository. + string webhook_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents an OAuth token of the account that authorized the Connection, +// and associated metadata. +message OAuthCredential { + // A SecretManager resource containing the OAuth token that authorizes + // the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`. + string oauth_token_secret_version = 1 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // Output only. The username associated to this token. + string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a personal access token that authorized the Connection, +// and associated metadata. +message UserCredential { + // Required. A SecretManager resource containing the user token that + // authorizes the Cloud Build connection. Format: + // `projects/*/secrets/*/versions/*`. + string user_token_secret_version = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Output only. The username associated to this token. + string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Message for creating a Connection +message CreateConnectionRequest { + // Required. Project and location where the connection will be created. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The Connection to create. + Connection connection = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the Connection, which will become the final + // component of the Connection's resource name. Names must be unique + // per-project per-location. Allows alphanumeric characters and any of + // -._~%!$&'()*+,;=@. + string connection_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Message for getting the details of a Connection. +message GetConnectionRequest { + // Required. The name of the Connection to retrieve. + // Format: `projects/*/locations/*/connections/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; +} + +// Message for requesting list of Connections. +message ListConnectionsRequest { + // Required. The parent, which owns this collection of Connections. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Page start. + string page_token = 3; +} + +// Message for response to listing Connections. +message ListConnectionsResponse { + // The list of Connections. + repeated Connection connections = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Message for updating a Connection. +message UpdateConnectionRequest { + // Required. The Connection to update. + Connection connection = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the connection is not found a new connection + // will be created. In this situation `update_mask` is ignored. + // The creation will succeed only if the input connection has all the + // necessary information (e.g a github_config with both user_oauth_token and + // installation_id properties). + bool allow_missing = 3; + + // The current etag of the connection. + // If an etag is provided and does not match the current etag of the + // connection, update will be blocked and an ABORTED error will be returned. + string etag = 4; +} + +// Message for deleting a Connection. +message DeleteConnectionRequest { + // Required. The name of the Connection to delete. + // Format: `projects/*/locations/*/connections/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // The current etag of the connection. + // If an etag is provided and does not match the current etag of the + // connection, deletion will be blocked and an ABORTED error will be returned. + string etag = 2; + + // If set, validate the request, but do not actually post it. + bool validate_only = 3; +} + +// Message for creating a Repository. +message CreateRepositoryRequest { + // Required. The connection to contain the repository. If the request is part + // of a BatchCreateRepositoriesRequest, this field should be empty or match + // the parent specified there. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The repository to create. + Repository repository = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the repository, which will become the final + // component of the repository's resource name. This ID should be unique in + // the connection. Allows alphanumeric characters and any of + // -._~%!$&'()*+,;=@. + string repository_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Message for creating repositoritories in batch. +message BatchCreateRepositoriesRequest { + // Required. The connection to contain all the repositories being created. + // Format: projects/*/locations/*/connections/* + // The parent field in the CreateRepositoryRequest messages + // must either be empty or match this field. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // Required. The request messages specifying the repositories to create. + repeated CreateRepositoryRequest requests = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Message for response of creating repositories in batch. +message BatchCreateRepositoriesResponse { + // Repository resources created. + repeated Repository repositories = 1; +} + +// Message for getting the details of a Repository. +message GetRepositoryRequest { + // Required. The name of the Repository to retrieve. + // Format: `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for requesting list of Repositories. +message ListRepositoriesRequest { + // Required. The parent, which owns this collection of Repositories. + // Format: `projects/*/locations/*/connections/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Page start. + string page_token = 3; + + // A filter expression that filters resources listed in the response. + // Expressions must follow API improvement proposal + // [AIP-160](https://google.aip.dev/160). e.g. + // `remote_uri:"https://github.com*"`. + string filter = 4; +} + +// Message for response to listing Repositories. +message ListRepositoriesResponse { + // The list of Repositories. + repeated Repository repositories = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// Message for deleting a Repository. +message DeleteRepositoryRequest { + // Required. The name of the Repository to delete. + // Format: `projects/*/locations/*/connections/*/repositories/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // The current etag of the repository. + // If an etag is provided and does not match the current etag of the + // repository, deletion will be blocked and an ABORTED error will be returned. + string etag = 2; + + // If set, validate the request, but do not actually post it. + bool validate_only = 3; +} + +// Message for fetching SCM read/write token. +message FetchReadWriteTokenRequest { + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for fetching SCM read token. +message FetchReadTokenRequest { + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; +} + +// Message for responding to get read token. +message FetchReadTokenResponse { + // The token content. + string token = 1; + + // Expiration timestamp. Can be empty if unknown or non-expiring. + google.protobuf.Timestamp expiration_time = 2; +} + +// Message for responding to get read/write token. +message FetchReadWriteTokenResponse { + // The token content. + string token = 1; + + // Expiration timestamp. Can be empty if unknown or non-expiring. + google.protobuf.Timestamp expiration_time = 2; +} + +// RPC request object accepted by the ProcessWebhook RPC method. +message ProcessWebhookRequest { + // Required. Project and location where the webhook will be received. + // Format: `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/Connection" + } + ]; + + // HTTP request body. + google.api.HttpBody body = 2; + + // Arbitrary additional key to find the maching repository for a webhook event + // if needed. + string webhook_key = 3; +} + +// Request for fetching git refs +message FetchGitRefsRequest { + // Type of refs + enum RefType { + // No type specified. + REF_TYPE_UNSPECIFIED = 0; + + // To fetch tags. + TAG = 1; + + // To fetch branches. + BRANCH = 2; + } + + // Required. The resource name of the repository in the format + // `projects/*/locations/*/connections/*/repositories/*`. + string repository = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + } + ]; + + // Type of refs to fetch + RefType ref_type = 2; +} + +// Response for fetching git refs +message FetchGitRefsResponse { + // Name of the refs fetched. + repeated string ref_names = 1; +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js new file mode 100644 index 00000000000..7c9b6038278 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js @@ -0,0 +1,70 @@ +// Copyright 2023 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, requests) { + // [START cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The connection to contain all the repositories being created. + * Format: projects/* /locations/* /connections/* + * The parent field in the CreateRepositoryRequest messages + * must either be empty or match this field. + */ + // const parent = 'abc123' + /** + * Required. The request messages specifying the repositories to create. + */ + // const requests = 1234 + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callBatchCreateRepositories() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const [operation] = await cloudbuildClient.batchCreateRepositories(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js new file mode 100644 index 00000000000..1ff4f1186b5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js @@ -0,0 +1,76 @@ +// Copyright 2023 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, connection, connectionId) { + // [START cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Project and location where the connection will be created. + * Format: `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. The Connection to create. + */ + // const connection = {} + /** + * Required. The ID to use for the Connection, which will become the final + * component of the Connection's resource name. Names must be unique + * per-project per-location. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + */ + // const connectionId = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callCreateConnection() { + // Construct request + const request = { + parent, + connection, + connectionId, + }; + + // Run request + const [operation] = await cloudbuildClient.createConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js new file mode 100644 index 00000000000..d4def936139 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js @@ -0,0 +1,77 @@ +// Copyright 2023 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, repository, repositoryId) { + // [START cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The connection to contain the repository. If the request is part + * of a BatchCreateRepositoriesRequest, this field should be empty or match + * the parent specified there. + */ + // const parent = 'abc123' + /** + * Required. The repository to create. + */ + // const repository = {} + /** + * Required. The ID to use for the repository, which will become the final + * component of the repository's resource name. This ID should be unique in + * the connection. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + */ + // const repositoryId = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callCreateRepository() { + // Construct request + const request = { + parent, + repository, + repositoryId, + }; + + // Run request + const [operation] = await cloudbuildClient.createRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js new file mode 100644 index 00000000000..46a5ff3ce9a --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js @@ -0,0 +1,73 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_DeleteConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Connection to delete. + * Format: `projects/* /locations/* /connections/*`. + */ + // const name = 'abc123' + /** + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, deletion will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * If set, validate the request, but do not actually post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callDeleteConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js new file mode 100644 index 00000000000..42194417a03 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js @@ -0,0 +1,73 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_DeleteRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Repository to delete. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + */ + // const name = 'abc123' + /** + * The current etag of the repository. + * If an etag is provided and does not match the current etag of the + * repository, deletion will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + /** + * If set, validate the request, but do not actually post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callDeleteRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteRepository(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js new file mode 100644 index 00000000000..96728361b81 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js @@ -0,0 +1,66 @@ +// Copyright 2023 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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + /** + * Type of refs to fetch + */ + // const refType = {} + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchGitRefs() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchGitRefs(request); + console.log(response); + } + + callFetchGitRefs(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js new file mode 100644 index 00000000000..3d722ecc9ac --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js @@ -0,0 +1,72 @@ +// Copyright 2023 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(connection) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + */ + // const connection = 'abc123' + /** + * Number of results to return in the list. Default to 20. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchLinkableRepositories() { + // Construct request + const request = { + connection, + }; + + // Run request + const iterable = await cloudbuildClient.fetchLinkableRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callFetchLinkableRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js new file mode 100644 index 00000000000..623c8b64bc2 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js @@ -0,0 +1,62 @@ +// Copyright 2023 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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchReadToken() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchReadToken(request); + console.log(response); + } + + callFetchReadToken(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js new file mode 100644 index 00000000000..8aaabdabd84 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js @@ -0,0 +1,62 @@ +// Copyright 2023 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(repository) { + // [START cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + */ + // const repository = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callFetchReadWriteToken() { + // Construct request + const request = { + repository, + }; + + // Run request + const response = await cloudbuildClient.fetchReadWriteToken(request); + console.log(response); + } + + callFetchReadWriteToken(); + // [END cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js new file mode 100644 index 00000000000..f4146b898e5 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js @@ -0,0 +1,62 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_GetConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Connection to retrieve. + * Format: `projects/* /locations/* /connections/*`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callGetConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getConnection(request); + console.log(response); + } + + callGetConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_GetConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js new file mode 100644 index 00000000000..deca8de40e8 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js @@ -0,0 +1,62 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_GetRepository_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Repository to retrieve. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + */ + // const name = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callGetRepository() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudbuildClient.getRepository(request); + console.log(response); + } + + callGetRepository(); + // [END cloudbuild_v2_generated_RepositoryManager_GetRepository_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js new file mode 100644 index 00000000000..63a97011b65 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js @@ -0,0 +1,72 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_ListConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of Connections. + * Format: `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callListConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnections(); + // [END cloudbuild_v2_generated_RepositoryManager_ListConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js new file mode 100644 index 00000000000..fc2a8e319b2 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js @@ -0,0 +1,79 @@ +// Copyright 2023 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_v2_generated_RepositoryManager_ListRepositories_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of Repositories. + * Format: `projects/* /locations/* /connections/*`. + */ + // const parent = 'abc123' + /** + * Number of results to return in the list. + */ + // const pageSize = 1234 + /** + * Page start. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * AIP-160 (https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + */ + // const filter = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callListRepositories() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await cloudbuildClient.listRepositoriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRepositories(); + // [END cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js new file mode 100644 index 00000000000..4525a347001 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js @@ -0,0 +1,80 @@ +// Copyright 2023 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(connection) { + // [START cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Connection to update. + */ + // const connection = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + /** + * If set to true, and the connection is not found a new connection + * will be created. In this situation `update_mask` is ignored. + * The creation will succeed only if the input connection has all the + * necessary information (e.g a github_config with both user_oauth_token and + * installation_id properties). + */ + // const allowMissing = true + /** + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, update will be blocked and an ABORTED error will be returned. + */ + // const etag = 'abc123' + + // Imports the Cloudbuild library + const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; + + // Instantiates a client + const cloudbuildClient = new RepositoryManagerClient(); + + async function callUpdateConnection() { + // Construct request + const request = { + connection, + }; + + // Run request + const [operation] = await cloudbuildClient.updateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnection(); + // [END cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json new file mode 100644 index 00000000000..bf929148640 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json @@ -0,0 +1,655 @@ +{ + "clientLibrary": { + "name": "nodejs-cloudbuild", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.devtools.cloudbuild.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateConnection_async", + "title": "RepositoryManager createConnection Sample", + "origin": "API_DEFINITION", + "description": " Creates a Connection.", + "canonical": true, + "file": "repository_manager.create_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection", + "type": ".google.devtools.cloudbuild.v2.Connection" + }, + { + "name": "connection_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "CreateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetConnection_async", + "title": "RepositoryManager getConnection Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single connection.", + "canonical": true, + "file": "repository_manager.get_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.Connection", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "GetConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListConnections_async", + "title": "RepositoryManager listConnections Sample", + "origin": "API_DEFINITION", + "description": " Lists Connections in a given project and location.", + "canonical": true, + "file": "repository_manager.list_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnections", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.ListConnectionsResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "ListConnections", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async", + "title": "RepositoryManager updateConnection Sample", + "origin": "API_DEFINITION", + "description": " Updates a single connection.", + "canonical": true, + "file": "repository_manager.update_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", + "async": true, + "parameters": [ + { + "name": "connection", + "type": ".google.devtools.cloudbuild.v2.Connection" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "UpdateConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async", + "title": "RepositoryManager deleteConnection Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single connection.", + "canonical": true, + "file": "repository_manager.delete_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "DeleteConnection", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateRepository_async", + "title": "RepositoryManager createRepository Sample", + "origin": "API_DEFINITION", + "description": " Creates a Repository.", + "canonical": true, + "file": "repository_manager.create_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "repository", + "type": ".google.devtools.cloudbuild.v2.Repository" + }, + { + "name": "repository_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "CreateRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async", + "title": "RepositoryManager batchCreateRepositories Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple repositories inside a connection.", + "canonical": true, + "file": "repository_manager.batch_create_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "BatchCreateRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetRepository_async", + "title": "RepositoryManager getRepository Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single repository.", + "canonical": true, + "file": "repository_manager.get_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.Repository", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "GetRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListRepositories_async", + "title": "RepositoryManager listRepositories Sample", + "origin": "API_DEFINITION", + "description": " Lists Repositories in a given connection.", + "canonical": true, + "file": "repository_manager.list_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.ListRepositoriesResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "ListRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async", + "title": "RepositoryManager deleteRepository Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single repository.", + "canonical": true, + "file": "repository_manager.delete_repository.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "DeleteRepository", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async", + "title": "RepositoryManager fetchReadWriteToken Sample", + "origin": "API_DEFINITION", + "description": " Fetches read/write token of a given repository.", + "canonical": true, + "file": "repository_manager.fetch_read_write_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchReadWriteToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchReadWriteToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async", + "title": "RepositoryManager fetchReadToken Sample", + "origin": "API_DEFINITION", + "description": " Fetches read token of a given repository.", + "canonical": true, + "file": "repository_manager.fetch_read_token.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchReadToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchReadTokenResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchReadToken", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async", + "title": "RepositoryManager fetchLinkableRepositories Sample", + "origin": "API_DEFINITION", + "description": " FetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.", + "canonical": true, + "file": "repository_manager.fetch_linkable_repositories.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchLinkableRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", + "async": true, + "parameters": [ + { + "name": "connection", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchLinkableRepositoriesResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchLinkableRepositories", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + }, + { + "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async", + "title": "RepositoryManager fetchGitRefs Sample", + "origin": "API_DEFINITION", + "description": " Fetch the list of branches or tags for a given repository.", + "canonical": true, + "file": "repository_manager.fetch_git_refs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchGitRefs", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", + "async": true, + "parameters": [ + { + "name": "repository", + "type": "TYPE_STRING" + }, + { + "name": "ref_type", + "type": ".google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType" + } + ], + "resultType": ".google.devtools.cloudbuild.v2.FetchGitRefsResponse", + "client": { + "shortName": "RepositoryManagerClient", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" + }, + "method": { + "shortName": "FetchGitRefs", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", + "service": { + "shortName": "RepositoryManager", + "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts new file mode 100644 index 00000000000..87935397b2a --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 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 v2 from './v2'; +const RepositoryManagerClient = v2.RepositoryManagerClient; +type RepositoryManagerClient = v2.RepositoryManagerClient; +export {v2, RepositoryManagerClient}; +export default {v2, RepositoryManagerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..e99fba47b64 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json @@ -0,0 +1,175 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.devtools.cloudbuild.v2", + "libraryPackage": "@google-cloud/cloudbuild", + "services": { + "RepositoryManager": { + "clients": { + "grpc": { + "libraryClient": "RepositoryManagerClient", + "rpcs": { + "GetConnection": { + "methods": [ + "getConnection" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "FetchReadWriteToken": { + "methods": [ + "fetchReadWriteToken" + ] + }, + "FetchReadToken": { + "methods": [ + "fetchReadToken" + ] + }, + "FetchGitRefs": { + "methods": [ + "fetchGitRefs" + ] + }, + "CreateConnection": { + "methods": [ + "createConnection" + ] + }, + "UpdateConnection": { + "methods": [ + "updateConnection" + ] + }, + "DeleteConnection": { + "methods": [ + "deleteConnection" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "BatchCreateRepositories": { + "methods": [ + "batchCreateRepositories" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "ListConnections": { + "methods": [ + "listConnections", + "listConnectionsStream", + "listConnectionsAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "FetchLinkableRepositories": { + "methods": [ + "fetchLinkableRepositories", + "fetchLinkableRepositoriesStream", + "fetchLinkableRepositoriesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RepositoryManagerClient", + "rpcs": { + "GetConnection": { + "methods": [ + "getConnection" + ] + }, + "GetRepository": { + "methods": [ + "getRepository" + ] + }, + "FetchReadWriteToken": { + "methods": [ + "fetchReadWriteToken" + ] + }, + "FetchReadToken": { + "methods": [ + "fetchReadToken" + ] + }, + "FetchGitRefs": { + "methods": [ + "fetchGitRefs" + ] + }, + "CreateConnection": { + "methods": [ + "createConnection" + ] + }, + "UpdateConnection": { + "methods": [ + "updateConnection" + ] + }, + "DeleteConnection": { + "methods": [ + "deleteConnection" + ] + }, + "CreateRepository": { + "methods": [ + "createRepository" + ] + }, + "BatchCreateRepositories": { + "methods": [ + "batchCreateRepositories" + ] + }, + "DeleteRepository": { + "methods": [ + "deleteRepository" + ] + }, + "ListConnections": { + "methods": [ + "listConnections", + "listConnectionsStream", + "listConnectionsAsync" + ] + }, + "ListRepositories": { + "methods": [ + "listRepositories", + "listRepositoriesStream", + "listRepositoriesAsync" + ] + }, + "FetchLinkableRepositories": { + "methods": [ + "fetchLinkableRepositories", + "fetchLinkableRepositoriesStream", + "fetchLinkableRepositoriesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts new file mode 100644 index 00000000000..026d90530f0 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 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 {RepositoryManagerClient} from './repository_manager_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts new file mode 100644 index 00000000000..9981fbf72b9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts @@ -0,0 +1,2603 @@ +// Copyright 2023 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/repository_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './repository_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages connections to source code repositories. + * @class + * @memberof v2 + */ +export class RepositoryManagerClient { + 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}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + repositoryManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RepositoryManagerClient. + * + * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new RepositoryManagerClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof RepositoryManagerClient; + 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + connectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connections/{connection}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' + ), + secretVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}/versions/{version}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}' + ), + }; + + // 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 = { + listConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connections'), + listRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), + fetchLinkableRepositories: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories') + }; + + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/connections/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/connections/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/connections/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectionResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; + const createConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const updateConnectionResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; + const updateConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const deleteConnectionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectionMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const createRepositoryResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.Repository') as gax.protobuf.Type; + const createRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const batchCreateRepositoriesResponse = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.BatchCreateRepositoriesResponse') as gax.protobuf.Type; + const batchCreateRepositoriesMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + const deleteRepositoryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRepositoryMetadata = protoFilesRoot.lookup( + '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectionResponse.decode.bind(createConnectionResponse), + createConnectionMetadata.decode.bind(createConnectionMetadata)), + updateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectionResponse.decode.bind(updateConnectionResponse), + updateConnectionMetadata.decode.bind(updateConnectionMetadata)), + deleteConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectionResponse.decode.bind(deleteConnectionResponse), + deleteConnectionMetadata.decode.bind(deleteConnectionMetadata)), + createRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRepositoryResponse.decode.bind(createRepositoryResponse), + createRepositoryMetadata.decode.bind(createRepositoryMetadata)), + batchCreateRepositories: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateRepositoriesResponse.decode.bind(batchCreateRepositoriesResponse), + batchCreateRepositoriesMetadata.decode.bind(batchCreateRepositoriesMetadata)), + deleteRepository: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), + deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devtools.cloudbuild.v2.RepositoryManager', 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 = this._gaxModule.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.repositoryManagerStub) { + return this.repositoryManagerStub; + } + + // Put together the "service stub" for + // google.devtools.cloudbuild.v2.RepositoryManager. + this.repositoryManagerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v2.RepositoryManager') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devtools.cloudbuild.v2.RepositoryManager, + 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 repositoryManagerStubMethods = + ['createConnection', 'getConnection', 'listConnections', 'updateConnection', 'deleteConnection', 'createRepository', 'batchCreateRepositories', 'getRepository', 'listRepositories', 'deleteRepository', 'fetchReadWriteToken', 'fetchReadToken', 'fetchLinkableRepositories', 'fetchGitRefs']; + for (const methodName of repositoryManagerStubMethods) { + const callPromise = this.repositoryManagerStub.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._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.repositoryManagerStub; + } + + /** + * 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 -- + // ------------------- +/** + * Gets details of a single connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Connection to retrieve. + * Format: `projects/* /locations/* /connections/*`. + * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection}. + * 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/v2/repository_manager.get_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_GetConnection_async + */ + getConnection( + request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined + ]>; + getConnection( + request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): void; + getConnection( + request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): void; + getConnection( + request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection, + protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConnection(request, options, callback); + } +/** + * Gets details of a single repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Repository to retrieve. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. + * 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/v2/repository_manager.get_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_GetRepository_async + */ + getRepository( + request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined + ]>; + getRepository( + request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): void; + getRepository( + request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository, + protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRepository(request, options, callback); + } +/** + * Fetches read/write token of a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @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 {@link google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse | FetchReadWriteTokenResponse}. + * 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/v2/repository_manager.fetch_read_write_token.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async + */ + fetchReadWriteToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined + ]>; + fetchReadWriteToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadWriteToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadWriteToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchReadWriteToken(request, options, callback); + } +/** + * Fetches read token of a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @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 {@link google.devtools.cloudbuild.v2.FetchReadTokenResponse | FetchReadTokenResponse}. + * 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/v2/repository_manager.fetch_read_token.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async + */ + fetchReadToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined + ]>; + fetchReadToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadToken( + request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): void; + fetchReadToken( + request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, + protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchReadToken(request, options, callback); + } +/** + * Fetch the list of branches or tags for a given repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.repository + * Required. The resource name of the repository in the format + * `projects/* /locations/* /connections/* /repositories/*`. + * @param {google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType} request.refType + * Type of refs to fetch + * @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 {@link google.devtools.cloudbuild.v2.FetchGitRefsResponse | FetchGitRefsResponse}. + * 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/v2/repository_manager.fetch_git_refs.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async + */ + fetchGitRefs( + request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined + ]>; + fetchGitRefs( + request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): void; + fetchGitRefs( + request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + callback: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): void; + fetchGitRefs( + request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, + protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'repository': request.repository ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchGitRefs(request, options, callback); + } + +/** + * Creates a Connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location where the connection will be created. + * Format: `projects/* /locations/*`. + * @param {google.devtools.cloudbuild.v2.Connection} request.connection + * Required. The Connection to create. + * @param {string} request.connectionId + * Required. The ID to use for the Connection, which will become the final + * component of the Connection's resource name. Names must be unique + * per-project per-location. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + * @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/v2/repository_manager.create_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async + */ + createConnection( + request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnection( + request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnection( + request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnection( + request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnection()`. + * @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/v2/repository_manager.create_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async + */ + async checkCreateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devtools.cloudbuild.v2.Connection} request.connection + * Required. The Connection to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @param {boolean} request.allowMissing + * If set to true, and the connection is not found a new connection + * will be created. In this situation `update_mask` is ignored. + * The creation will succeed only if the input connection has all the + * necessary information (e.g a github_config with both user_oauth_token and + * installation_id properties). + * @param {string} request.etag + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, update will be blocked and an ABORTED error will be returned. + * @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/v2/repository_manager.update_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async + */ + updateConnection( + request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnection( + request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnection( + request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnection( + request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection.name': request.connection!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnection()`. + * @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/v2/repository_manager.update_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async + */ + async checkUpdateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Connection to delete. + * Format: `projects/* /locations/* /connections/*`. + * @param {string} request.etag + * The current etag of the connection. + * If an etag is provided and does not match the current etag of the + * connection, deletion will be blocked and an ABORTED error will be returned. + * @param {boolean} request.validateOnly + * If set, validate the request, 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/v2/repository_manager.delete_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async + */ + deleteConnection( + request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnection( + request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnection( + request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnection( + request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnection()`. + * @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/v2/repository_manager.delete_connection.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async + */ + async checkDeleteConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a Repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The connection to contain the repository. If the request is part + * of a BatchCreateRepositoriesRequest, this field should be empty or match + * the parent specified there. + * @param {google.devtools.cloudbuild.v2.Repository} request.repository + * Required. The repository to create. + * @param {string} request.repositoryId + * Required. The ID to use for the repository, which will become the final + * component of the repository's resource name. This ID should be unique in + * the connection. Allows alphanumeric characters and any of + * -._~%!$&'()*+,;=@. + * @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/v2/repository_manager.create_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async + */ + createRepository( + request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRepository( + request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRepository( + request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRepository()`. + * @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/v2/repository_manager.create_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async + */ + async checkCreateRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates multiple repositories inside a connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The connection to contain all the repositories being created. + * Format: projects/* /locations/* /connections/* + * The parent field in the CreateRepositoryRequest messages + * must either be empty or match this field. + * @param {number[]} request.requests + * Required. The request messages specifying the repositories 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/v2/repository_manager.batch_create_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async + */ + batchCreateRepositories( + request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + batchCreateRepositories( + request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateRepositories( + request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + batchCreateRepositories( + request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateRepositories(request, options, callback); + } +/** + * Check the status of the long running operation returned by `batchCreateRepositories()`. + * @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/v2/repository_manager.batch_create_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async + */ + async checkBatchCreateRepositoriesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateRepositories, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single repository. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Repository to delete. + * Format: `projects/* /locations/* /connections/* /repositories/*`. + * @param {string} request.etag + * The current etag of the repository. + * If an etag is provided and does not match the current etag of the + * repository, deletion will be blocked and an ABORTED error will be returned. + * @param {boolean} request.validateOnly + * If set, validate the request, 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/v2/repository_manager.delete_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async + */ + deleteRepository( + request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRepository( + request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRepository( + request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRepository(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRepository()`. + * @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/v2/repository_manager.delete_repository.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async + */ + async checkDeleteRepositoryProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Connections in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection}. + * 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 `listConnectionsAsync()` + * 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. + */ + listConnections( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection[], + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse + ]>; + listConnections( + request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): void; + listConnections( + request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): void; + listConnections( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IConnection>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IConnection[], + protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, + protos.google.devtools.cloudbuild.v2.IListConnectionsResponse + ]>|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConnections(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, which owns this collection of Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection} 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 `listConnectionsAsync()` + * 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. + */ + listConnectionsStream( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnections.createStream( + this.innerApiCalls.listConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnections`, 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, which owns this collection of Connections. + * Format: `projects/* /locations/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @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 + * {@link google.devtools.cloudbuild.v2.Connection | Connection}. 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/v2/repository_manager.list_connections.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_ListConnections_async + */ + listConnectionsAsync( + request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnections.asyncIterate( + this.innerApiCalls['listConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists Repositories in a given connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. + * 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 `listRepositoriesAsync()` + * 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. + */ + listRepositories( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse + ]>; + listRepositories( + request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + listRepositories( + request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + listRepositories( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse + ]>|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRepositories(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, which owns this collection of Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository} 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 `listRepositoriesAsync()` + * 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. + */ + listRepositoriesStream( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.createStream( + this.innerApiCalls.listRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRepositories`, 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, which owns this collection of Repositories. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Page start. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * Expressions must follow API improvement proposal + * [AIP-160](https://google.aip.dev/160). e.g. + * `remote_uri:"https://github.com*"`. + * @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 + * {@link google.devtools.cloudbuild.v2.Repository | Repository}. 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/v2/repository_manager.list_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_ListRepositories_async + */ + listRepositoriesAsync( + request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRepositories.asyncIterate( + this.innerApiCalls['listRepositories'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * FetchLinkableRepositories get repositories from SCM that are + * accessible and could be added to the connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. + * 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 `fetchLinkableRepositoriesAsync()` + * 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. + */ + fetchLinkableRepositories( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options?: CallOptions): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse + ]>; + fetchLinkableRepositories( + request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + fetchLinkableRepositories( + request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + callback: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): void; + fetchLinkableRepositories( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>, + callback?: PaginationCallback< + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, + protos.google.devtools.cloudbuild.v2.IRepository>): + Promise<[ + protos.google.devtools.cloudbuild.v2.IRepository[], + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, + protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse + ]>|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' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection': request.connection ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchLinkableRepositories(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.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository} 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 `fetchLinkableRepositoriesAsync()` + * 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. + */ + fetchLinkableRepositoriesStream( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection': request.connection ?? '', + }); + const defaultCallSettings = this._defaults['fetchLinkableRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchLinkableRepositories.createStream( + this.innerApiCalls.fetchLinkableRepositories as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `fetchLinkableRepositories`, 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.connection + * Required. The name of the Connection. + * Format: `projects/* /locations/* /connections/*`. + * @param {number} request.pageSize + * Number of results to return in the list. Default to 20. + * @param {string} request.pageToken + * Page start. + * @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 + * {@link google.devtools.cloudbuild.v2.Repository | Repository}. 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/v2/repository_manager.fetch_linkable_repositories.js + * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async + */ + fetchLinkableRepositoriesAsync( + request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection': request.connection ?? '', + }); + const defaultCallSettings = this._defaults['fetchLinkableRepositories']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchLinkableRepositories.asyncIterate( + this.innerApiCalls['fetchLinkableRepositories'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 {@link google.cloud.location.Location | Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * {@link google.cloud.location.Location | Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection + * @returns {string} Resource name string. + */ + connectionPath(project:string,location:string,connection:string) { + return this.pathTemplates.connectionPathTemplate.render({ + project: project, + location: location, + connection: connection, + }); + } + + /** + * Parse the project from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).project; + } + + /** + * Parse the location from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).location; + } + + /** + * Parse the connection from Connection resource. + * + * @param {string} connectionName + * A fully-qualified path representing Connection resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromConnectionName(connectionName: string) { + return this.pathTemplates.connectionPathTemplate.match(connectionName).connection; + } + + /** + * 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project:string,location:string,connection:string,repository:string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + connection: connection, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; + } + + /** + * Parse the connection from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the connection. + */ + matchConnectionFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; + } + + /** + * 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 service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} namespace + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,namespace:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + namespace: namespace, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the namespace from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the namespace. + */ + matchNamespaceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).namespace; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * 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.repositoryManagerStub && !this._terminated) { + return this.repositoryManagerStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json new file mode 100644 index 00000000000..6049df136e9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json @@ -0,0 +1,106 @@ +{ + "interfaces": { + "google.devtools.cloudbuild.v2.RepositoryManager": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetConnection": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListConnections": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchCreateRepositories": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRepository": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteRepository": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "FetchReadWriteToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchReadToken": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchLinkableRepositories": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchGitRefs": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json new file mode 100644 index 00000000000..12097f770a6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/devtools/cloudbuild/v2/cloudbuild.proto", + "../../protos/google/devtools/cloudbuild/v2/repositories.proto" +] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..20dca8dade6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 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 repositoryManagerClient = new cloudbuild.RepositoryManagerClient(); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..8c673824940 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 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 {RepositoryManagerClient} from '@google-cloud/cloudbuild'; + +// check that the client class type name can be used +function doStuffWithRepositoryManagerClient(client: RepositoryManagerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const repositoryManagerClient = new RepositoryManagerClient(); + doStuffWithRepositoryManagerClient(repositoryManagerClient); +} + +main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 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/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts new file mode 100644 index 00000000000..da45ca63502 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts @@ -0,0 +1,3384 @@ +// Copyright 2023 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 repositorymanagerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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('v2.RepositoryManagerClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = repositorymanagerModule.v2.RepositoryManagerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = repositorymanagerModule.v2.RepositoryManagerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = repositorymanagerModule.v2.RepositoryManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.repositoryManagerStub, undefined); + await client.initialize(); + assert(client.repositoryManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.repositoryManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.repositoryManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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('getConnection', () => { + it('invokes getConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Connection() + ); + client.innerApiCalls.getConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Connection() + ); + client.innerApiCalls.getConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnection( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnection with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnection(request), expectedError); + }); + }); + + describe('getRepository', () => { + it('invokes getRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); + const [response] = await client.getRepository(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.Repository() + ); + client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRepository( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRepository with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRepository(request), expectedError); + }); + }); + + describe('fetchReadWriteToken', () => { + it('invokes fetchReadWriteToken without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() + ); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(expectedResponse); + const [response] = await client.fetchReadWriteToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() + ); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchReadWriteToken( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchReadWriteToken(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadWriteToken with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchReadWriteToken(request), expectedError); + }); + }); + + describe('fetchReadToken', () => { + it('invokes fetchReadToken without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() + ); + client.innerApiCalls.fetchReadToken = stubSimpleCall(expectedResponse); + const [response] = await client.fetchReadToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() + ); + client.innerApiCalls.fetchReadToken = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchReadToken( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchReadToken = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchReadToken(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchReadToken with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchReadToken(request), expectedError); + }); + }); + + describe('fetchGitRefs', () => { + it('invokes fetchGitRefs without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() + ); + client.innerApiCalls.fetchGitRefs = stubSimpleCall(expectedResponse); + const [response] = await client.fetchGitRefs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() + ); + client.innerApiCalls.fetchGitRefs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchGitRefs( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedHeaderRequestParams = `repository=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchGitRefs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchGitRefs(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchGitRefs with closed client', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); + request.repository = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchGitRefs(request), expectedError); + }); + }); + + describe('createConnection', () => { + it('invokes createConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnection( + 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); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkCreateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkCreateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnection', () => { + it('invokes updateConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnection( + 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); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() + ); + request.connection ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); + request.connection.name = defaultValue1; + const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkUpdateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkUpdateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnection', () => { + it('invokes deleteConnection without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnection( + 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); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnection with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectionProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkDeleteConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectionProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkDeleteConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRepository', () => { + it('invokes createRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRepository( + 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); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRepository with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRepositoryProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkCreateRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRepositoryProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkCreateRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('batchCreateRepositories', () => { + it('invokes batchCreateRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateRepositories(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateRepositories( + 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); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateRepositories with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateRepositories(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchCreateRepositoriesProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkBatchCreateRepositoriesProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateRepositoriesProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkBatchCreateRepositoriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRepository', () => { + it('invokes deleteRepository without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRepository(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRepository( + 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); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with call error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRepository(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRepository with LRO error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRepository(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRepositoryProgress without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkDeleteRepositoryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRepositoryProgress with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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.checkDeleteRepositoryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnections', () => { + it('invokes listConnections without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.innerApiCalls.listConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnections without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.innerApiCalls.listConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnections( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnections with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionsStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.descriptors.page.listConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { + 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.listConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); + assert( + (client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectionsStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); + assert( + (client.descriptors.page.listConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnections without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), + ]; + client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; + const iterable = client.listConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnections with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRepositories', () => { + it('invokes listRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.listRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRepositoriesStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + 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.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRepositoriesStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); + assert( + (client.descriptors.page.listRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + const iterable = client.listRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('fetchLinkableRepositories', () => { + it('invokes fetchLinkableRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(expectedResponse); + const [response] = await client.fetchLinkableRepositories(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositories without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchLinkableRepositories( + request, + (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchLinkableRepositories(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchLinkableRepositoriesStream without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.fetchLinkableRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + 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.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); + assert( + (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes fetchLinkableRepositoriesStream with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchLinkableRepositoriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; + stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); + assert( + (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchLinkableRepositories without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), + ]; + client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + const iterable = client.fetchLinkableRepositoriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchLinkableRepositories with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); + request.connection = defaultValue1; + const expectedHeaderRequestParams = `connection=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchLinkableRepositoriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('connection', () => { + const fakePath = "/rendered/path/connection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection: "connectionValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectionPath', () => { + const result = client.connectionPath("projectValue", "locationValue", "connectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectionName', () => { + const result = client.matchProjectFromConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectionName', () => { + const result = client.matchLocationFromConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionFromConnectionName', () => { + const result = client.matchConnectionFromConnectionName(fakePath); + assert.strictEqual(result, "connectionValue"); + assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + 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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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('repository', () => { + const fakePath = "/rendered/path/repository"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection: "connectionValue", + repository: "repositoryValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath("projectValue", "locationValue", "connectionValue", "repositoryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionFromRepositoryName', () => { + const result = client.matchConnectionFromRepositoryName(fakePath); + assert.strictEqual(result, "connectionValue"); + assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, "repositoryValue"); + assert((client.pathTemplates.repositoryPathTemplate.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 repositorymanagerModule.v2.RepositoryManagerClient({ + 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('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + namespace: "namespaceValue", + service: "serviceValue", + }; + const client = new repositorymanagerModule.v2.RepositoryManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "namespaceValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNamespaceFromServiceName', () => { + const result = client.matchNamespaceFromServiceName(fakePath); + assert.strictEqual(result, "namespaceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/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/google-devtools-cloudbuild/v2/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js new file mode 100644 index 00000000000..0c12d4dc6a9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/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: 'RepositoryManager', + filename: './repository-manager.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 89da44a21afba21b2dd7f8d4caafc4bec56f2d0a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 21 Jul 2023 21:04:08 +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 --- .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../google-devtools-cloudbuild/v1/.gitignore | 14 - .../google-devtools-cloudbuild/v1/.jsdoc.js | 55 - .../google-devtools-cloudbuild/v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../google-devtools-cloudbuild/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../v1/package.json | 64 - .../devtools/cloudbuild/v1/cloudbuild.proto | 2720 ------ .../generated/v1/cloud_build.approve_build.js | 67 - .../generated/v1/cloud_build.cancel_build.js | 71 - .../generated/v1/cloud_build.create_build.js | 72 - .../v1/cloud_build.create_build_trigger.js | 71 - .../v1/cloud_build.create_worker_pool.js | 81 - .../v1/cloud_build.delete_build_trigger.js | 71 - .../v1/cloud_build.delete_worker_pool.js | 79 - .../generated/v1/cloud_build.get_build.js | 71 - .../v1/cloud_build.get_build_trigger.js | 71 - .../v1/cloud_build.get_worker_pool.js | 62 - .../v1/cloud_build.list_build_triggers.js | 76 - .../generated/v1/cloud_build.list_builds.js | 85 - .../v1/cloud_build.list_worker_pools.js | 74 - .../v1/cloud_build.receive_trigger_webhook.js | 77 - .../generated/v1/cloud_build.retry_build.js | 72 - .../v1/cloud_build.run_build_trigger.js | 77 - .../v1/cloud_build.update_build_trigger.js | 71 - .../v1/cloud_build.update_worker_pool.js | 73 - ...etadata.google.devtools.cloudbuild.v1.json | 899 -- .../v1/src/index.ts | 25 - .../v1/src/v1/cloud_build_client.ts | 3328 ------- .../v1/src/v1/cloud_build_client_config.json | 114 - .../v1/src/v1/cloud_build_proto_list.json | 3 - .../v1/src/v1/gapic_metadata.json | 215 - .../v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_cloud_build_v1.ts | 3520 -------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v2/.eslintignore | 7 - .../v2/.eslintrc.json | 3 - .../google-devtools-cloudbuild/v2/.gitignore | 14 - .../google-devtools-cloudbuild/v2/.jsdoc.js | 55 - .../google-devtools-cloudbuild/v2/.mocharc.js | 33 - .../v2/.prettierrc.js | 22 - .../google-devtools-cloudbuild/v2/README.md | 1 - .../v2/linkinator.config.json | 16 - .../v2/package.json | 64 - .../devtools/cloudbuild/v2/cloudbuild.proto | 112 - .../devtools/cloudbuild/v2/repositories.proto | 802 -- ...itory_manager.batch_create_repositories.js | 70 - .../repository_manager.create_connection.js | 76 - .../repository_manager.create_repository.js | 77 - .../repository_manager.delete_connection.js | 73 - .../repository_manager.delete_repository.js | 73 - .../v2/repository_manager.fetch_git_refs.js | 66 - ...ory_manager.fetch_linkable_repositories.js | 72 - .../v2/repository_manager.fetch_read_token.js | 62 - ...pository_manager.fetch_read_write_token.js | 62 - .../v2/repository_manager.get_connection.js | 62 - .../v2/repository_manager.get_repository.js | 62 - .../v2/repository_manager.list_connections.js | 72 - .../repository_manager.list_repositories.js | 79 - .../repository_manager.update_connection.js | 80 - ...etadata.google.devtools.cloudbuild.v2.json | 655 -- .../v2/src/index.ts | 25 - .../v2/src/v2/gapic_metadata.json | 175 - .../v2/src/v2/index.ts | 19 - .../v2/src/v2/repository_manager_client.ts | 2603 ------ .../v2/repository_manager_client_config.json | 106 - .../src/v2/repository_manager_proto_list.json | 4 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2/system-test/install.ts | 49 - .../v2/test/gapic_repository_manager_v2.ts | 3384 ------- .../v2/tsconfig.json | 19 - .../v2/webpack.config.js | 64 - .../devtools/cloudbuild/v1/cloudbuild.proto | 190 + .../protos/protos.d.ts | 546 +- .../protos/protos.js | 7969 ++++++++++------- .../protos/protos.json | 202 +- .../src/v1/cloud_build_client.ts | 140 + .../test/gapic_cloud_build_v1.ts | 177 + 85 files changed, 5997 insertions(+), 25074 deletions(-) delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/README.md delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/package.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/README.md delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/package.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js deleted file mode 100644 index 09c8e7ac916..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/cloudbuild', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/README.md b/owl-bot-staging/google-devtools-cloudbuild/v1/README.md deleted file mode 100644 index 1e997bef7bc..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/package.json b/owl-bot-staging/google-devtools-cloudbuild/v1/package.json deleted file mode 100644 index eff88724d8e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/ && minifyProtoJson", - "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": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto deleted file mode 100644 index b864bed355a..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ /dev/null @@ -1,2720 +0,0 @@ -// Copyright 2023 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/api/routing.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 = "cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_package = "com.google.cloudbuild.v1"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V1"; -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: "gkehub.googleapis.com/Membership" - pattern: "projects/{project}/locations/{location}/memberships/{cluster_name}" -}; -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}" -}; -option (google.api.resource_definition) = { - type: "cloudbuild.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" -}; - -// 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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - 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 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/builds/*" - } - }; - 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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/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.routing) = { - routing_parameters { - field: "trigger.resource_name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,trigger"; - } - - // Runs a `BuildTrigger` at a particular source revision. - // - // To run a regional or global trigger, use the POST request - // that includes the location endpoint in the path (ex. - // v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The - // POST request that does not include the location endpoint in the path can - // only be used when running global triggers. - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/triggers/*" - } - }; - 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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/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.routing) = { - routing_parameters { - field: "name" - path_template: "projects/*/locations/{location=*}/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.routing) = { - routing_parameters { - field: "worker_pool.name" - path_template: "projects/*/locations/{location=*}/workerPools/*" - } - }; - 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.routing) = { - routing_parameters { - field: "parent" - path_template: "projects/*/locations/{location=*}" - } - }; - 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. - // Branch and tag names cannot consist of regular expressions. - RepoSource source = 3; -} - -// Location of the source in an archive file in Cloud Storage. -message StorageSource { - // Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Cloud Storage object containing the source. - // - // This object must be a zipped (`.zip`) or gzipped archive file (`.tar.gz`) - // containing source to build. - string object = 2; - - // 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 any accessible Git repository. -message GitSource { - // Location of the Git repo to build. - // - // This will be used as a `git remote`, see - // https://git-scm.com/docs/git-remote. - string url = 1; - - // 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 = 5; - - // The revision to fetch from the Git repository such as a branch, a tag, a - // commit SHA, or any Git ref. - // - // Cloud Build uses `git fetch` to fetch the revision from the Git - // repository; therefore make sure that the string you provide for `revision` - // is parsable by the command. For information on string values accepted by - // `git fetch`, see - // https://git-scm.com/docs/gitrevisions#_specifying_revisions. For - // information on `git fetch`, see https://git-scm.com/docs/git-fetch. - string revision = 6; -} - -// 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 Cloud Storage. -// This feature is in Preview; see description -// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). -message StorageSourceManifest { - // Cloud Storage bucket containing the source manifest (see [Bucket - // Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Cloud Storage object containing the source manifest. - // - // This object must be a JSON file. - string object = 2; - - // 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 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 Git repository. - GitSource git_source = 5; - - // If provided, get the source from this manifest in 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]; -} - -// Artifact uploaded using the PythonPackage directive. -message UploadedPythonPackage { - // URI of the uploaded artifact. - string uri = 1; - - // Hash types and values of the Python Artifact. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Maven artifact uploaded using the MavenArtifact directive. -message UploadedMavenArtifact { - // URI of the uploaded artifact. - string uri = 1; - - // Hash types and values of the Maven Artifact. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An npm package uploaded to Artifact Registry using the NpmPackage -// directive. -message UploadedNpmPackage { - // URI of the uploaded npm package. - string uri = 1; - - // Hash types and values of the npm package. - FileHashes file_hashes = 2; - - // Output only. Stores timing information for pushing the specified artifact. - TimeSpan push_timing = 3 [(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]; - - // Allow this build step to fail without failing the entire build. - // - // If false, the entire build will fail if this step fails. Otherwise, the - // build will succeed, but this step will still have a failure status. - // Error information will be reported in the failure_detail field. - bool allow_failure = 14; - - // Output only. Return code from running the step. - int32 exit_code = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allow this build step to fail without failing the entire build if and - // only if the exit code is one of the specified codes. If allow_failure - // is also specified, this field will take precedence. - repeated int32 allow_exit_codes = 18; - - // 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 for non-container artifacts uploaded to Cloud - // Storage. Only populated when artifacts are uploaded to Cloud Storage. - string artifact_manifest = 4; - - // Number of non-container artifacts uploaded to Cloud Storage. Only populated - // when artifacts are uploaded to Cloud Storage. - 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 to Cloud Storage. - TimeSpan artifact_timing = 7; - - // Python artifacts uploaded to Artifact Registry at the end of the build. - repeated UploadedPythonPackage python_packages = 8; - - // Maven artifacts uploaded to Artifact Registry at the end of the build. - repeated UploadedMavenArtifact maven_artifacts = 9; - - // Npm packages uploaded to Artifact Registry at the end of the build. - repeated UploadedNpmPackage npm_packages = 12; -} - -// 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 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. -// - $LOCATION: the location/region 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}" - }; - - // 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; - } - - // 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; - } - - // 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 60 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; - - // 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 artifacts including docker images and non docker - // artifacts. - // * 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 Maven artifact to upload to Artifact Registry upon successful completion - // of all build steps. - message MavenArtifact { - // Artifact Registry repository, in the form - // "https://$REGION-maven.pkg.dev/$PROJECT/$REPOSITORY" - // - // Artifact in the workspace specified by path will be uploaded to - // Artifact Registry with this location as a prefix. - string repository = 1; - - // Path to an artifact in the build's workspace to be uploaded to - // Artifact Registry. - // This can be either an absolute path, - // e.g. /workspace/my-app/target/my-app-1.0.SNAPSHOT.jar - // or a relative path from /workspace, - // e.g. my-app/target/my-app-1.0.SNAPSHOT.jar. - string path = 2; - - // Maven `artifactId` value used when uploading the artifact to Artifact - // Registry. - string artifact_id = 3; - - // Maven `groupId` value used when uploading the artifact to Artifact - // Registry. - string group_id = 4; - - // Maven `version` value used when uploading the artifact to Artifact - // Registry. - string version = 5; - } - - // Python package to upload to Artifact Registry upon successful completion - // of all build steps. A package can encapsulate multiple objects to be - // uploaded to a single repository. - message PythonPackage { - // Artifact Registry repository, in the form - // "https://$REGION-python.pkg.dev/$PROJECT/$REPOSITORY" - // - // Files in the workspace matching any path pattern will be uploaded to - // Artifact Registry with this location as a prefix. - string repository = 1; - - // Path globs used to match files in the build's workspace. For Python/ - // Twine, this is usually `dist/*`, and sometimes additionally an `.asc` - // file. - repeated string paths = 2; - } - - // Npm package to upload to Artifact Registry upon successful completion - // of all build steps. - message NpmPackage { - // Artifact Registry repository, in the form - // "https://$REGION-npm.pkg.dev/$PROJECT/$REPOSITORY" - // - // Npm package in the workspace specified by path will be zipped and - // uploaded to Artifact Registry with this location as a prefix. - string repository = 1; - - // Path to the package.json. - // e.g. workspace/path/to/package - string package_path = 2; - } - - // 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; - - // A list of Maven artifacts to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // Artifacts in the workspace matching specified paths globs will be uploaded - // to the specified Artifact Registry repository using the builder service - // account's credentials. - // - // If any artifacts fail to be pushed, the build is marked FAILURE. - repeated MavenArtifact maven_artifacts = 3; - - // A list of Python packages to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // The build service account credentials will be used to perform the upload. - // - // If any objects fail to be pushed, the build is marked FAILURE. - repeated PythonPackage python_packages = 5; - - // A list of npm packages to be uploaded to Artifact Registry upon - // successful completion of all build steps. - // - // Npm packages in the specified paths will be uploaded - // to the specified Artifact Registry repository using the builder service - // account's credentials. - // - // If any packages fail to be pushed, the build is marked FAILURE. - repeated NpmPackage npm_packages = 6; -} - -// 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; - - // Use a sha512 hash. - SHA512 = 4; - } - - // 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]; -} - -// GitRepoSource describes a repo and ref of a code repository. -message GitRepoSource { - // The URI of the repo (e.g. https://github.com/user/repo.git). - // Either `uri` or `repository` can be specified and is required. - string uri = 1; - - // The source of the SCM repo. - oneof source { - // The connected repository resource name, in the format - // `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or - // `repository` can be specified and is required. - string repository = 6 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - } - - // The branch or tag to use. Must start with "refs/" (required). - string ref = 2; - - // See RepoType below. - GitFileSource.RepoType repo_type = 3; - - // The resource name of the enterprise config that should be applied - // to this source. - oneof enterprise_config { - // The full resource name of the github enterprise config. - // Format: - // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. - // `projects/{project}/githubEnterpriseConfigs/{id}`. - string github_enterprise_config = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - }]; - } -} - -// GitFileSource describes a file within a (possibly remote) code repository. -message GitFileSource { - // The type of the repo, since it may not be explicit from the `repo` field - // (e.g from a URL). - enum RepoType { - // The default, unknown repo type. Don't use it, instead use one of - // the other repo types. - UNKNOWN = 0; - - // A Google Cloud Source Repositories-hosted repo. - CLOUD_SOURCE_REPOSITORIES = 1; - - // A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub - // Enterprise). - GITHUB = 2; - - // A Bitbucket Server-hosted repo. - BITBUCKET_SERVER = 3; - - // A GitLab-hosted repo. - GITLAB = 4; - } - - // The path of the file, with the repo root as the root of the path. - string path = 1; - - // The URI of the repo. - // Either uri or repository can be specified. - // If unspecified, the repo from which the trigger invocation originated is - // assumed to be the repo from which to read the specified path. - string uri = 2; - - // The source of the SCM repo. - oneof source { - // The fully qualified resource name of the Repos API repository. - // Either URI or repository can be specified. - // If unspecified, the repo from which the trigger invocation originated is - // assumed to be the repo from which to read the specified path. - string repository = 7 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - } - - // See RepoType above. - RepoType repo_type = 3; - - // The branch, tag, arbitrary ref, or SHA version of the repo to use when - // resolving the filename (optional). - // This field respects the same syntax/resolution as described here: - // https://git-scm.com/docs/gitrevisions - // If unspecified, the revision from which the trigger invocation originated - // is assumed to be the revision from which to read the specified path. - string revision = 4; - - // The resource name of the enterprise config that should be applied - // to this source. - oneof enterprise_config { - // The full resource name of the github enterprise config. - // Format: - // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. - // `projects/{project}/githubEnterpriseConfigs/{id}`. - string github_enterprise_config = 5 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - }]; - } -} - -// Configuration for an automated build in response to source repository -// changes. -message BuildTrigger { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - pattern: "projects/{project}/triggers/{trigger}" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" - plural: "triggers" - singular: "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. - // At least one of the template fields must be provided. - 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; - - // The file source describing the local or remote Build template. - GitFileSource git_file_source = 24; - } - - // 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 repo and ref of the repository from which to build. This field - // is used only for those triggers that do not respond to SCM events. - // Triggers that respond to such events build source at whatever commit - // caused the event. - // This field is currently only used by Webhook, Pub/Sub, Manual, and Cron - // triggers. - GitRepoSource source_to_build = 26; - - // 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" - }]; - - // The configuration of a trigger that creates a build whenever an event from - // Repo API is received. - RepositoryEventConfig repository_event_config = 39; -} - -// The configuration of a trigger that creates a build whenever an event from -// Repo API is received. -message RepositoryEventConfig { - // All possible SCM repo types from Repo API. - enum RepositoryType { - // If unspecified, RepositoryType defaults to GITHUB. - REPOSITORY_TYPE_UNSPECIFIED = 0; - - // The SCM repo is GITHUB. - GITHUB = 1; - - // The SCM repo is GITHUB Enterprise. - GITHUB_ENTERPRISE = 2; - - // The SCM repo is GITLAB Enterprise. - GITLAB_ENTERPRISE = 3; - } - - // The resource name of the Repo API resource. - string repository = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - }]; - - // Output only. The type of the SCM vendor the repository points to. - RepositoryType repository_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The types of filter to trigger a build. - oneof filter { - // Filter to match changes in pull requests. - PullRequestFilter pull_request = 3; - - // Filter to match changes in refs like branches, tags. - PushFilter push = 4; - } -} - -// GitHubEventsConfig describes the configuration of a trigger that creates a -// build whenever a GitHub event is received. -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 { - // Specifies the manner in which the build should be verified, if at all. - // - // If a verified build is requested, and any part of the process to generate - // and upload provenance fails, the build will also fail. - // - // If the build does not request verification then that process may occur, but - // is not guaranteed to. If it does occur and fails, the build will not fail. - // - // For more information, see [Viewing Build - // Provenance](https://cloud.google.com/build/docs/securing-builds/view-build-provenance). - enum VerifyOption { - // Not a verifiable build (the default). - NOT_VERIFIED = 0; - - // Build must be verified. - 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; - - // E2 machine with 1 CPU. - E2_MEDIUM = 7; - } - - // 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 Cloud Storage. - enum LogStreamingOption { - // Service may automatically determine build log streaming behavior. - STREAM_DEFAULT = 0; - - // Build logs should be streamed to Cloud Storage. - STREAM_ON = 1; - - // Build logs should not be streamed to Cloud Storage; they will be - // written when the build is completed. - STREAM_OFF = 2; - } - - // 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 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; - - // Build logs are stored in Cloud Logging and Cloud Storage. - LEGACY = 1; - - // Build logs are stored in Cloud Storage. - GCS_ONLY = 2; - - // This option is the same as CLOUD_LOGGING_ONLY. - STACKDRIVER_ONLY = 3 [deprecated = true]; - - // Build logs are stored in Cloud Logging. Selecting this option will not - // allow [logs - // streaming](https://cloud.google.com/sdk/gcloud/reference/builds/log). - CLOUD_LOGGING_ONLY = 5; - - // Turn off all logging. No build logs will be captured. - NONE = 4; - } - - // Default GCS log bucket behavior options. - enum DefaultLogsBucketBehavior { - // Unspecified. - DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED = 0; - - // Bucket is located in user-owned project in the same region as the - // build. The builder service account must have access to create and write - // to GCS buckets in the build project. - REGIONAL_USER_OWNED_BUCKET = 1; - } - - // 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 2000GB; 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 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; - - // Optional. Option to specify how default logs buckets are setup. - DefaultLogsBucketBehavior default_logs_bucket_behavior = 21 - [(google.api.field_behavior) = OPTIONAL]; -} - -// 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 {} - -message GitHubEnterpriseConfig { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" - pattern: "projects/{project}/githubEnterpriseConfigs/{config}" - pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" - }; - - // Optional. The full resource name for the GitHubEnterpriseConfig - // For example: - // "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}" - string name = 7 [(google.api.field_behavior) = OPTIONAL]; - - // The URL of the github enterprise host the configuration is for. - string host_url = 3; - - // Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise - // server. - int64 app_id = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Time when the installation was associated with the project. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The key that should be attached to webhook calls to the ReceiveWebhook - // endpoint. - string webhook_key = 8; - - // Optional. The network to be used when reaching out to the GitHub - // Enterprise server. The VPC network must be enabled for private - // service connection. This should be set if the GitHub Enterprise server is - // hosted on-premises and not reachable by public internet. - // If this field is left empty, no network peering will occur and calls to - // the GitHub Enterprise server will be made over the public internet. - // Must be in the format - // `projects/{project}/global/networks/{network}`, where {project} - // is a project number or id and {network} is the name of a - // VPC network in the project. - string peered_network = 9 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Names of secrets in Secret Manager. - GitHubEnterpriseSecrets secrets = 10; - - // Name to display for this config. - string display_name = 11; - - // Optional. SSL certificate to use for requests to GitHub Enterprise. - string ssl_ca = 12 [(google.api.field_behavior) = OPTIONAL]; -} - -// GitHubEnterpriseSecrets represents the names of all necessary secrets in -// Secret Manager for a GitHub Enterprise server. -// Format is: projects//secrets/. -message GitHubEnterpriseSecrets { - // The resource name for the private key secret version. - string private_key_version_name = 5 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the webhook secret secret version in Secret Manager. - string webhook_secret_version_name = 6 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the OAuth secret secret version in Secret Manager. - string oauth_secret_version_name = 7 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // The resource name for the OAuth client ID secret version in Secret Manager. - string oauth_client_id_version_name = 8 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; -} - -// 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; - - // `WorkerPool` is being updated; new builds cannot be run. - UPDATING = 5; - } - - // 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]; - - // Configuration for the `WorkerPool`. - oneof config { - // Legacy Private Pool 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 2000. 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; - - // Immutable. Subnet IP range within the peered network. This is specified - // in CIDR notation with a slash and the subnet prefix size. You can - // optionally specify an IP address before the subnet prefix value. e.g. - // `192.168.0.0/29` would specify an IP range starting at 192.168.0.0 with a - // prefix size of 29 bits. - // `/16` would specify a prefix size of 16 bits, with an automatically - // determined IP within the peered VPC. - // If unspecified, a value of `/24` will be used. - string peered_network_ip_range = 3 - [(google.api.field_behavior) = IMMUTABLE]; - } - - // 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/{location}/workerPools/{workerPool}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - } - ]; - - // Optional. If provided, it must match the server's etag on the workerpool - // for the request to be processed. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js deleted file mode 100644 index 8b0d3fb6a27..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.approve_build.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js deleted file mode 100644 index db4b5cc4a2b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.cancel_build.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js deleted file mode 100644 index 4b5eaf08a32..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js deleted file mode 100644 index 4ecc084fa67..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_build_trigger.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js deleted file mode 100644 index d06ff8cb64c..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.create_worker_pool.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js deleted file mode 100644 index 716af8a093d..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_build_trigger.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js deleted file mode 100644 index 9475c1af929..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.delete_worker_pool.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the `WorkerPool` to delete. - * Format: - * `projects/{project}/locations/{location}/workerPools/{workerPool}`. - */ - // const name = 'abc123' - /** - * Optional. If 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js deleted file mode 100644 index 4a51363d4b5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js deleted file mode 100644 index 6a2d62f21b6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_build_trigger.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js deleted file mode 100644 index 03a02cb42b7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.get_worker_pool.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js deleted file mode 100644 index 973a4f720fd..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_build_triggers.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js deleted file mode 100644 index a19245f4d07..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_builds.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js deleted file mode 100644 index 51cbd24e9fb..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.list_worker_pools.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js deleted file mode 100644 index 11ca471ed4e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.receive_trigger_webhook.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js deleted file mode 100644 index 7a3341c3944..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.retry_build.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js deleted file mode 100644 index 5ea555bab67..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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. - * Branch and tag names cannot consist of regular expressions. - */ - // 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js deleted file mode 100644 index ebccd60ca2d..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_build_trigger.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js deleted file mode 100644 index 5a07273017c..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.update_worker_pool.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/snippet_metadata.google.devtools.cloudbuild.v1.json deleted file mode 100644 index 6e529400fb2..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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": 64, - "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": 63, - "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": 77, - "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": 63, - "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 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": 64, - "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": 59, - "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": 63, - "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": 63, - "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": 68, - "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": 63, - "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": 63, - "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. To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.", - "canonical": true, - "file": "cloud_build.run_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "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": 69, - "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": 73, - "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": 54, - "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": 71, - "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": 65, - "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": 66, - "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/google-devtools-cloudbuild/v1/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts deleted file mode 100644 index 68941b8a880..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts deleted file mode 100644 index 10565979b75..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts +++ /dev/null @@ -1,3328 +0,0 @@ -// Copyright 2023 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new CloudBuildClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/builds/{build}' - ), - projectConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/githubEnterpriseConfigs/{config}' - ), - projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - projectLocationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}' - ), - projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - projectTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/triggers/{trigger}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' - ), - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=operations/**}:cancel',body: '*',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=operations/**}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.protobuf.Empty | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.trigger?.resourceName; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse | 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' - ] = this._gaxModule.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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBuild, this._gaxModule.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 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.retryBuild, this._gaxModule.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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/builds/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.approveBuild, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Runs a `BuildTrigger` at a particular source revision. - * - * To run a regional or global trigger, use the POST request - * that includes the location endpoint in the path (ex. - * v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The - * POST request that does not include the location endpoint in the path can - * only be used when running global triggers. - * - * @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. - * Branch and tag names cannot consist of regular expressions. - * @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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/triggers/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runBuildTrigger, this._gaxModule.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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createWorkerPool, this._gaxModule.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/{location}/workerPools/{workerPool}`. - * @param {string} [request.etag] - * Optional. If 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteWorkerPool, this._gaxModule.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 || {}; - let routingParameter = {}; - { - const fieldValue = request.workerPool?.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)/workerPools/[^/]+')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateWorkerPool, this._gaxModule.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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.Build | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.createStream( - this.innerApiCalls.listBuilds as 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 - * {@link google.devtools.cloudbuild.v1.Build | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {}, - 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.createStream( - this.innerApiCalls.listBuildTriggers as 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 - * {@link google.devtools.cloudbuild.v1.BuildTrigger | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {}, - 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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.createStream( - this.innerApiCalls.listWorkerPools as 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 - * {@link google.devtools.cloudbuild.v1.WorkerPool | 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 || {}; - let routingParameter = {}; - { - const fieldValue = request.parent; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/locations/(?[^/]+)')); - if (match) { - const parameterValue = match.groups?.['location'] ?? fieldValue; - Object.assign(routingParameter, { location: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - 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 {}, - 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 network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * 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 projectConfig resource name string. - * - * @param {string} project - * @param {string} config - * @returns {string} Resource name string. - */ - projectConfigPath(project:string,config:string) { - return this.pathTemplates.projectConfigPathTemplate.render({ - project: project, - config: config, - }); - } - - /** - * Parse the project from ProjectConfig resource. - * - * @param {string} projectConfigName - * A fully-qualified path representing project_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConfigName(projectConfigName: string) { - return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).project; - } - - /** - * Parse the config from ProjectConfig resource. - * - * @param {string} projectConfigName - * A fully-qualified path representing project_config resource. - * @returns {string} A string representing the config. - */ - matchConfigFromProjectConfigName(projectConfigName: string) { - return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName).config; - } - - /** - * 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 projectLocationConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} config - * @returns {string} Resource name string. - */ - projectLocationConfigPath(project:string,location:string,config:string) { - return this.pathTemplates.projectLocationConfigPathTemplate.render({ - project: project, - location: location, - config: config, - }); - } - - /** - * Parse the project from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).project; - } - - /** - * Parse the location from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).location; - } - - /** - * Parse the config from ProjectLocationConfig resource. - * - * @param {string} projectLocationConfigName - * A fully-qualified path representing project_location_config resource. - * @returns {string} A string representing the config. - */ - matchConfigFromProjectLocationConfigName(projectLocationConfigName: string) { - return this.pathTemplates.projectLocationConfigPathTemplate.match(projectLocationConfigName).config; - } - - /** - * 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 repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,connection:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - connection: connection, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the connection from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * 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/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client_config.json deleted file mode 100644 index c677cba6cb7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_proto_list.json deleted file mode 100644 index ef522572f3b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 33226421337..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/src/v1/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts deleted file mode 100644 index f01e5acb61b..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 21a069f2aec..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9d43cef7252..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts deleted file mode 100644 index e3376f4a516..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts +++ /dev/null @@ -1,3520 +0,0 @@ -// Copyright 2023 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'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelBuild = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBuildTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - 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.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBuildTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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.trigger = {}; - // path template: projects/*/locations/{location=*}/triggers/* - request.trigger.resourceName = 'projects/value/locations/value/triggers/value'; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - 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); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - 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); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger=${defaultValue2}&name=${defaultValue3}`; - const expectedError = new Error('expected'); - client.innerApiCalls.receiveTriggerWebhook = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.receiveTriggerWebhook(request), expectedError); - const actualRequest = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.receiveTriggerWebhook as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['trigger']); - request.trigger = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest', ['name']); - request.name = defaultValue3; - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.getWorkerPool = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.retryBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.retryBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.retryBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.retryBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.approveBuild(request), expectedError); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/builds/* - request.name = 'projects/value/locations/value/builds/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.approveBuild = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.approveBuild(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.approveBuild as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runBuildTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/triggers/* - request.name = 'projects/value/locations/value/triggers/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.runBuildTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runBuildTrigger(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runBuildTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.createWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*}/workerPools/* - request.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - 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); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateWorkerPool(request), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 = {}; - // path template: projects/*/locations/{location=*}/workerPools/* - request.workerPool.name = 'projects/value/locations/value/workerPools/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.updateWorkerPool = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateWorkerPool(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateWorkerPool as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuilds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuilds(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuilds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuilds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuilds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuildTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuildTriggers(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuildTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuildTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listBuildTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value';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); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.listWorkerPools = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listWorkerPools(request), expectedError); - const actualRequest = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listWorkerPools as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listWorkerPools.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - // path template: projects/*/locations/{location=*} - request.parent = 'projects/value/locations/value'; - const expectedHeaderRequestParams = 'location=value'; - 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( - (client.descriptors.page.listWorkerPools.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.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('projectConfig', () => { - const fakePath = "/rendered/path/projectConfig"; - const expectedParameters = { - project: "projectValue", - config: "configValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConfigPath', () => { - const result = client.projectConfigPath("projectValue", "configValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConfigName', () => { - const result = client.matchProjectFromProjectConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConfigFromProjectConfigName', () => { - const result = client.matchConfigFromProjectConfigName(fakePath); - assert.strictEqual(result, "configValue"); - assert((client.pathTemplates.projectConfigPathTemplate.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('projectLocationConfig', () => { - const fakePath = "/rendered/path/projectLocationConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - config: "configValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConfigPath', () => { - const result = client.projectLocationConfigPath("projectValue", "locationValue", "configValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConfigName', () => { - const result = client.matchProjectFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConfigName', () => { - const result = client.matchLocationFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConfigFromProjectLocationConfigName', () => { - const result = client.matchConfigFromProjectLocationConfigName(fakePath); - assert.strictEqual(result, "configValue"); - assert((client.pathTemplates.projectLocationConfigPathTemplate.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('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection: "connectionValue", - repository: "repositoryValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "connectionValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionFromRepositoryName', () => { - const result = client.matchConnectionFromRepositoryName(fakePath); - assert.strictEqual(result, "connectionValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.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/google-devtools-cloudbuild/v1/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/google-devtools-cloudbuild/v1/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v1/webpack.config.js deleted file mode 100644 index f667feb1580..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/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/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json b/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore b/owl-bot-staging/google-devtools-cloudbuild/v2/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.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/google-devtools-cloudbuild/v2/.jsdoc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js deleted file mode 100644 index 09c8e7ac916..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 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 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/cloudbuild', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v2/.prettierrc.js b/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v2/README.md b/owl-bot-staging/google-devtools-cloudbuild/v2/README.md deleted file mode 100644 index 1e997bef7bc..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Cloudbuild: Nodejs Client diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/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/google-devtools-cloudbuild/v2/package.json b/owl-bot-staging/google-devtools-cloudbuild/v2/package.json deleted file mode 100644 index 39238c28b76..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/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", - "repository manager" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "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": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto deleted file mode 100644 index 8a2fb350d39..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/cloudbuild.proto +++ /dev/null @@ -1,112 +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 -// -// 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.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.CloudBuild.V2"; -option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudBuildProto"; -option java_package = "com.google.cloudbuild.v2"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V2"; -option ruby_package = "Google::Cloud::Build::V2"; -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: "cloudbuild.googleapis.com/githubEnterpriseConfig" - pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" -}; - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents the custom metadata of the RunWorkflow long-running operation. -message RunWorkflowCustomOperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. ID of the pipeline run created by RunWorkflow. - string pipeline_run_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto deleted file mode 100644 index 41583e70d4e..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto +++ /dev/null @@ -1,802 +0,0 @@ -// Copyright 2023 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.v2; - -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/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.CloudBuild.V2"; -option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; -option java_multiple_files = true; -option java_outer_classname = "RepositoryManagerProto"; -option java_package = "com.google.cloudbuild.v2"; -option objc_class_prefix = "GCB"; -option php_namespace = "Google\\Cloud\\Build\\V2"; -option ruby_package = "Google::Cloud::Build::V2"; -option (google.api.resource_definition) = { - type: "servicedirectory.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" -}; - -// Manages connections to source code repositories. -service RepositoryManager { - option (google.api.default_host) = "cloudbuild.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Connection. - rpc CreateConnection(CreateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/connections" - body: "connection" - }; - option (google.api.method_signature) = "parent,connection,connection_id"; - option (google.longrunning.operation_info) = { - response_type: "Connection" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Gets details of a single connection. - rpc GetConnection(GetConnectionRequest) returns (Connection) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/connections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Connections in a given project and location. - rpc ListConnections(ListConnectionsRequest) - returns (ListConnectionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/connections" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a single connection. - rpc UpdateConnection(UpdateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2/{connection.name=projects/*/locations/*/connections/*}" - body: "connection" - }; - option (google.api.method_signature) = "connection,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Connection" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Deletes a single connection. - rpc DeleteConnection(DeleteConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/connections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Creates a Repository. - rpc CreateRepository(CreateRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" - body: "repository" - }; - option (google.api.method_signature) = "parent,repository,repository_id"; - option (google.longrunning.operation_info) = { - response_type: "Repository" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Creates multiple repositories inside a connection. - rpc BatchCreateRepositories(BatchCreateRepositoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories:batchCreate" - body: "*" - }; - option (google.api.method_signature) = "parent,requests"; - option (google.longrunning.operation_info) = { - response_type: "BatchCreateRepositoriesResponse" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Gets details of a single repository. - rpc GetRepository(GetRepositoryRequest) returns (Repository) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists Repositories in a given connection. - rpc ListRepositories(ListRepositoriesRequest) - returns (ListRepositoriesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a single repository. - rpc DeleteRepository(DeleteRepositoryRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" - }; - } - - // Fetches read/write token of a given repository. - rpc FetchReadWriteToken(FetchReadWriteTokenRequest) - returns (FetchReadWriteTokenResponse) { - option (google.api.http) = { - post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadWriteToken" - body: "*" - }; - option (google.api.method_signature) = "repository"; - } - - // Fetches read token of a given repository. - rpc FetchReadToken(FetchReadTokenRequest) returns (FetchReadTokenResponse) { - option (google.api.http) = { - post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadToken" - body: "*" - }; - option (google.api.method_signature) = "repository"; - } - - // FetchLinkableRepositories get repositories from SCM that are - // accessible and could be added to the connection. - rpc FetchLinkableRepositories(FetchLinkableRepositoriesRequest) - returns (FetchLinkableRepositoriesResponse) { - option (google.api.http) = { - get: "/v2/{connection=projects/*/locations/*/connections/*}:fetchLinkableRepositories" - }; - } - - // Fetch the list of branches or tags for a given repository. - rpc FetchGitRefs(FetchGitRefsRequest) returns (FetchGitRefsResponse) { - option (google.api.http) = { - get: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs" - }; - option (google.api.method_signature) = "repository"; - } -} - -// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or -// GitLab. -message Connection { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Connection" - pattern: "projects/{project}/locations/{location}/connections/{connection}" - plural: "connections" - singular: "connection" - style: DECLARATIVE_FRIENDLY - }; - - // Immutable. The resource name of the connection, in the format - // `projects/{project}/locations/{location}/connections/{connection_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Server assigned timestamp for when the connection was created. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server assigned timestamp for when the connection was updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configuration for the connection depending on the type of provider. - oneof connection_config { - // Configuration for connections to github.com. - GitHubConfig github_config = 5; - - // Configuration for connections to an instance of GitHub Enterprise. - GitHubEnterpriseConfig github_enterprise_config = 6; - - // Configuration for connections to gitlab.com or an instance of GitLab - // Enterprise. - GitLabConfig gitlab_config = 7; - } - - // Output only. Installation state of the Connection. - InstallationState installation_state = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If disabled is set to true, functionality is disabled for this connection. - // Repository based API methods and webhooks processing for repositories in - // this connection will be disabled. - bool disabled = 13; - - // Output only. Set to true when the connection is being set up or updated in - // the background. - bool reconciling = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to store small amounts of arbitrary data. - map annotations = 15; - - // This checksum is computed by the server based on the value of other - // fields, and may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 16; -} - -// Describes stage and necessary actions to be taken by the -// user to complete the installation. Used for GitHub and GitHub Enterprise -// based connections. -message InstallationState { - // Stage of the installation process. - enum Stage { - // No stage specified. - STAGE_UNSPECIFIED = 0; - - // Only for GitHub Enterprise. An App creation has been requested. - // The user needs to confirm the creation in their GitHub enterprise host. - PENDING_CREATE_APP = 1; - - // User needs to authorize the GitHub (or Enterprise) App via OAuth. - PENDING_USER_OAUTH = 2; - - // User needs to follow the link to install the GitHub (or Enterprise) App. - PENDING_INSTALL_APP = 3; - - // Installation process has been completed. - COMPLETE = 10; - } - - // Output only. Current step of the installation process. - Stage stage = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Message of what the user should do next to continue the - // installation. Empty string if the installation is already complete. - string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Link to follow for next action. Empty string if the - // installation is already complete. - string action_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for FetchLinkableRepositories. -message FetchLinkableRepositoriesRequest { - // Required. The name of the Connection. - // Format: `projects/*/locations/*/connections/*`. - string connection = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Number of results to return in the list. Default to 20. - int32 page_size = 2; - - // Page start. - string page_token = 3; -} - -// Response message for FetchLinkableRepositories. -message FetchLinkableRepositoriesResponse { - // repositories ready to be created. - repeated Repository repositories = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Configuration for connections to github.com. -message GitHubConfig { - // OAuth credential of the account that authorized the Cloud Build GitHub App. - // It is recommended to use a robot account instead of a human user account. - // The OAuth token must be tied to the Cloud Build GitHub App. - OAuthCredential authorizer_credential = 1; - - // GitHub App installation id. - int64 app_installation_id = 2; -} - -// Configuration for connections to an instance of GitHub Enterprise. -message GitHubEnterpriseConfig { - // Required. The URI of the GitHub Enterprise host this connection is for. - string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. API Key used for authentication of webhook events. - string api_key = 12 [(google.api.field_behavior) = REQUIRED]; - - // Id of the GitHub App created from the manifest. - int64 app_id = 2; - - // The URL-friendly name of the GitHub App. - string app_slug = 13; - - // SecretManager resource containing the private key of the GitHub App, - // formatted as `projects/*/secrets/*/versions/*`. - string private_key_secret_version = 4 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // SecretManager resource containing the webhook secret of the GitHub App, - // formatted as `projects/*/secrets/*/versions/*`. - string webhook_secret_secret_version = 5 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // ID of the installation of the GitHub App. - int64 app_installation_id = 9; - - // Configuration for using Service Directory to privately connect to a GitHub - // Enterprise server. This should only be set if the GitHub Enterprise server - // is hosted on-premises and not reachable by public internet. If this field - // is left empty, calls to the GitHub Enterprise server will be made over the - // public internet. - ServiceDirectoryConfig service_directory_config = 10; - - // SSL certificate to use for requests to GitHub Enterprise. - string ssl_ca = 11; - - // Output only. GitHub Enterprise version installed at the host_uri. - string server_version = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Configuration for connections to gitlab.com or an instance of GitLab -// Enterprise. -message GitLabConfig { - // The URI of the GitLab Enterprise host this connection is for. - // If not specified, the default value is https://gitlab.com. - string host_uri = 1; - - // Required. Immutable. SecretManager resource containing the webhook secret - // of a GitLab Enterprise project, formatted as - // `projects/*/secrets/*/versions/*`. - string webhook_secret_secret_version = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Required. A GitLab personal access token with the minimum `read_api` scope - // access. - UserCredential read_authorizer_credential = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A GitLab personal access token with the `api` scope access. - UserCredential authorizer_credential = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Configuration for using Service Directory to privately connect to a GitLab - // Enterprise server. This should only be set if the GitLab Enterprise server - // is hosted on-premises and not reachable by public internet. If this field - // is left empty, calls to the GitLab Enterprise server will be made over the - // public internet. - ServiceDirectoryConfig service_directory_config = 5; - - // SSL certificate to use for requests to GitLab Enterprise. - string ssl_ca = 6; - - // Output only. Version of the GitLab Enterprise server running on the - // `host_uri`. - string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// ServiceDirectoryConfig represents Service Directory configuration for a -// connection. -message ServiceDirectoryConfig { - // Required. The Service Directory service name. - // Format: - // projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "servicedirectory.googleapis.com/Service" - } - ]; -} - -// A repository associated to a parent connection. -message Repository { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/Repository" - pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" - plural: "repositories" - singular: "repository" - style: DECLARATIVE_FRIENDLY - }; - - // Immutable. Resource name of the repository, in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. Git Clone HTTPS URI. - string remote_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Server assigned timestamp for when the connection was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server assigned timestamp for when the connection was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows clients to store small amounts of arbitrary data. - map annotations = 6; - - // This checksum is computed by the server based on the value of other - // fields, and may be sent on update and delete requests to ensure the - // client has an up-to-date value before proceeding. - string etag = 7; - - // Output only. External ID of the webhook created for the repository. - string webhook_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents an OAuth token of the account that authorized the Connection, -// and associated metadata. -message OAuthCredential { - // A SecretManager resource containing the OAuth token that authorizes - // the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`. - string oauth_token_secret_version = 1 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // Output only. The username associated to this token. - string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a personal access token that authorized the Connection, -// and associated metadata. -message UserCredential { - // Required. A SecretManager resource containing the user token that - // authorizes the Cloud Build connection. Format: - // `projects/*/secrets/*/versions/*`. - string user_token_secret_version = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Output only. The username associated to this token. - string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Message for creating a Connection -message CreateConnectionRequest { - // Required. Project and location where the connection will be created. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The Connection to create. - Connection connection = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the Connection, which will become the final - // component of the Connection's resource name. Names must be unique - // per-project per-location. Allows alphanumeric characters and any of - // -._~%!$&'()*+,;=@. - string connection_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for getting the details of a Connection. -message GetConnectionRequest { - // Required. The name of the Connection to retrieve. - // Format: `projects/*/locations/*/connections/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; -} - -// Message for requesting list of Connections. -message ListConnectionsRequest { - // Required. The parent, which owns this collection of Connections. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Page start. - string page_token = 3; -} - -// Message for response to listing Connections. -message ListConnectionsResponse { - // The list of Connections. - repeated Connection connections = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Message for updating a Connection. -message UpdateConnectionRequest { - // Required. The Connection to update. - Connection connection = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the connection is not found a new connection - // will be created. In this situation `update_mask` is ignored. - // The creation will succeed only if the input connection has all the - // necessary information (e.g a github_config with both user_oauth_token and - // installation_id properties). - bool allow_missing = 3; - - // The current etag of the connection. - // If an etag is provided and does not match the current etag of the - // connection, update will be blocked and an ABORTED error will be returned. - string etag = 4; -} - -// Message for deleting a Connection. -message DeleteConnectionRequest { - // Required. The name of the Connection to delete. - // Format: `projects/*/locations/*/connections/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // The current etag of the connection. - // If an etag is provided and does not match the current etag of the - // connection, deletion will be blocked and an ABORTED error will be returned. - string etag = 2; - - // If set, validate the request, but do not actually post it. - bool validate_only = 3; -} - -// Message for creating a Repository. -message CreateRepositoryRequest { - // Required. The connection to contain the repository. If the request is part - // of a BatchCreateRepositoriesRequest, this field should be empty or match - // the parent specified there. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The repository to create. - Repository repository = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the repository, which will become the final - // component of the repository's resource name. This ID should be unique in - // the connection. Allows alphanumeric characters and any of - // -._~%!$&'()*+,;=@. - string repository_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for creating repositoritories in batch. -message BatchCreateRepositoriesRequest { - // Required. The connection to contain all the repositories being created. - // Format: projects/*/locations/*/connections/* - // The parent field in the CreateRepositoryRequest messages - // must either be empty or match this field. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // Required. The request messages specifying the repositories to create. - repeated CreateRepositoryRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Message for response of creating repositories in batch. -message BatchCreateRepositoriesResponse { - // Repository resources created. - repeated Repository repositories = 1; -} - -// Message for getting the details of a Repository. -message GetRepositoryRequest { - // Required. The name of the Repository to retrieve. - // Format: `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for requesting list of Repositories. -message ListRepositoriesRequest { - // Required. The parent, which owns this collection of Repositories. - // Format: `projects/*/locations/*/connections/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Page start. - string page_token = 3; - - // A filter expression that filters resources listed in the response. - // Expressions must follow API improvement proposal - // [AIP-160](https://google.aip.dev/160). e.g. - // `remote_uri:"https://github.com*"`. - string filter = 4; -} - -// Message for response to listing Repositories. -message ListRepositoriesResponse { - // The list of Repositories. - repeated Repository repositories = 1; - - // A token identifying a page of results the server should return. - string next_page_token = 2; -} - -// Message for deleting a Repository. -message DeleteRepositoryRequest { - // Required. The name of the Repository to delete. - // Format: `projects/*/locations/*/connections/*/repositories/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // The current etag of the repository. - // If an etag is provided and does not match the current etag of the - // repository, deletion will be blocked and an ABORTED error will be returned. - string etag = 2; - - // If set, validate the request, but do not actually post it. - bool validate_only = 3; -} - -// Message for fetching SCM read/write token. -message FetchReadWriteTokenRequest { - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for fetching SCM read token. -message FetchReadTokenRequest { - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; -} - -// Message for responding to get read token. -message FetchReadTokenResponse { - // The token content. - string token = 1; - - // Expiration timestamp. Can be empty if unknown or non-expiring. - google.protobuf.Timestamp expiration_time = 2; -} - -// Message for responding to get read/write token. -message FetchReadWriteTokenResponse { - // The token content. - string token = 1; - - // Expiration timestamp. Can be empty if unknown or non-expiring. - google.protobuf.Timestamp expiration_time = 2; -} - -// RPC request object accepted by the ProcessWebhook RPC method. -message ProcessWebhookRequest { - // Required. Project and location where the webhook will be received. - // Format: `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/Connection" - } - ]; - - // HTTP request body. - google.api.HttpBody body = 2; - - // Arbitrary additional key to find the maching repository for a webhook event - // if needed. - string webhook_key = 3; -} - -// Request for fetching git refs -message FetchGitRefsRequest { - // Type of refs - enum RefType { - // No type specified. - REF_TYPE_UNSPECIFIED = 0; - - // To fetch tags. - TAG = 1; - - // To fetch branches. - BRANCH = 2; - } - - // Required. The resource name of the repository in the format - // `projects/*/locations/*/connections/*/repositories/*`. - string repository = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Repository" - } - ]; - - // Type of refs to fetch - RefType ref_type = 2; -} - -// Response for fetching git refs -message FetchGitRefsResponse { - // Name of the refs fetched. - repeated string ref_names = 1; -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js deleted file mode 100644 index 7c9b6038278..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.batch_create_repositories.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 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, requests) { - // [START cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The connection to contain all the repositories being created. - * Format: projects/* /locations/* /connections/* - * The parent field in the CreateRepositoryRequest messages - * must either be empty or match this field. - */ - // const parent = 'abc123' - /** - * Required. The request messages specifying the repositories to create. - */ - // const requests = 1234 - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callBatchCreateRepositories() { - // Construct request - const request = { - parent, - requests, - }; - - // Run request - const [operation] = await cloudbuildClient.batchCreateRepositories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchCreateRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js deleted file mode 100644 index 1ff4f1186b5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_connection.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 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, connection, connectionId) { - // [START cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project and location where the connection will be created. - * Format: `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. The Connection to create. - */ - // const connection = {} - /** - * Required. The ID to use for the Connection, which will become the final - * component of the Connection's resource name. Names must be unique - * per-project per-location. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - */ - // const connectionId = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callCreateConnection() { - // Construct request - const request = { - parent, - connection, - connectionId, - }; - - // Run request - const [operation] = await cloudbuildClient.createConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_CreateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js deleted file mode 100644 index d4def936139..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.create_repository.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 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, repository, repositoryId) { - // [START cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The connection to contain the repository. If the request is part - * of a BatchCreateRepositoriesRequest, this field should be empty or match - * the parent specified there. - */ - // const parent = 'abc123' - /** - * Required. The repository to create. - */ - // const repository = {} - /** - * Required. The ID to use for the repository, which will become the final - * component of the repository's resource name. This ID should be unique in - * the connection. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - */ - // const repositoryId = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callCreateRepository() { - // Construct request - const request = { - parent, - repository, - repositoryId, - }; - - // Run request - const [operation] = await cloudbuildClient.createRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_CreateRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js deleted file mode 100644 index 46a5ff3ce9a..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_connection.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_DeleteConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Connection to delete. - * Format: `projects/* /locations/* /connections/*`. - */ - // const name = 'abc123' - /** - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, deletion will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * If set, validate the request, but do not actually post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callDeleteConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js deleted file mode 100644 index 42194417a03..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.delete_repository.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_DeleteRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Repository to delete. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - */ - // const name = 'abc123' - /** - * The current etag of the repository. - * If an etag is provided and does not match the current etag of the - * repository, deletion will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - /** - * If set, validate the request, but do not actually post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callDeleteRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteRepository(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js deleted file mode 100644 index 96728361b81..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_git_refs.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - /** - * Type of refs to fetch - */ - // const refType = {} - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchGitRefs() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchGitRefs(request); - console.log(response); - } - - callFetchGitRefs(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js deleted file mode 100644 index 3d722ecc9ac..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_linkable_repositories.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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(connection) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - */ - // const connection = 'abc123' - /** - * Number of results to return in the list. Default to 20. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchLinkableRepositories() { - // Construct request - const request = { - connection, - }; - - // Run request - const iterable = await cloudbuildClient.fetchLinkableRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callFetchLinkableRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js deleted file mode 100644 index 623c8b64bc2..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_token.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchReadToken() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchReadToken(request); - console.log(response); - } - - callFetchReadToken(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js deleted file mode 100644 index 8aaabdabd84..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.fetch_read_write_token.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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(repository) { - // [START cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - */ - // const repository = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callFetchReadWriteToken() { - // Construct request - const request = { - repository, - }; - - // Run request - const response = await cloudbuildClient.fetchReadWriteToken(request); - console.log(response); - } - - callFetchReadWriteToken(); - // [END cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js deleted file mode 100644 index f4146b898e5..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_connection.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_GetConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Connection to retrieve. - * Format: `projects/* /locations/* /connections/*`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callGetConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getConnection(request); - console.log(response); - } - - callGetConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_GetConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js deleted file mode 100644 index deca8de40e8..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.get_repository.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_GetRepository_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Repository to retrieve. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - */ - // const name = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callGetRepository() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await cloudbuildClient.getRepository(request); - console.log(response); - } - - callGetRepository(); - // [END cloudbuild_v2_generated_RepositoryManager_GetRepository_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js deleted file mode 100644 index 63a97011b65..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_connections.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_ListConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of Connections. - * Format: `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callListConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnections(); - // [END cloudbuild_v2_generated_RepositoryManager_ListConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js deleted file mode 100644 index fc2a8e319b2..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.list_repositories.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2023 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_v2_generated_RepositoryManager_ListRepositories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of Repositories. - * Format: `projects/* /locations/* /connections/*`. - */ - // const parent = 'abc123' - /** - * Number of results to return in the list. - */ - // const pageSize = 1234 - /** - * Page start. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * AIP-160 (https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - */ - // const filter = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callListRepositories() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await cloudbuildClient.listRepositoriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRepositories(); - // [END cloudbuild_v2_generated_RepositoryManager_ListRepositories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js deleted file mode 100644 index 4525a347001..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/repository_manager.update_connection.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 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(connection) { - // [START cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Connection to update. - */ - // const connection = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - /** - * If set to true, and the connection is not found a new connection - * will be created. In this situation `update_mask` is ignored. - * The creation will succeed only if the input connection has all the - * necessary information (e.g a github_config with both user_oauth_token and - * installation_id properties). - */ - // const allowMissing = true - /** - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, update will be blocked and an ABORTED error will be returned. - */ - // const etag = 'abc123' - - // Imports the Cloudbuild library - const {RepositoryManagerClient} = require('@google-cloud/cloudbuild').v2; - - // Instantiates a client - const cloudbuildClient = new RepositoryManagerClient(); - - async function callUpdateConnection() { - // Construct request - const request = { - connection, - }; - - // Run request - const [operation] = await cloudbuildClient.updateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnection(); - // [END cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json deleted file mode 100644 index bf929148640..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json +++ /dev/null @@ -1,655 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-cloudbuild", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.devtools.cloudbuild.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateConnection_async", - "title": "RepositoryManager createConnection Sample", - "origin": "API_DEFINITION", - "description": " Creates a Connection.", - "canonical": true, - "file": "repository_manager.create_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection", - "type": ".google.devtools.cloudbuild.v2.Connection" - }, - { - "name": "connection_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "CreateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetConnection_async", - "title": "RepositoryManager getConnection Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single connection.", - "canonical": true, - "file": "repository_manager.get_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.Connection", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "GetConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListConnections_async", - "title": "RepositoryManager listConnections Sample", - "origin": "API_DEFINITION", - "description": " Lists Connections in a given project and location.", - "canonical": true, - "file": "repository_manager.list_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnections", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.ListConnectionsResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "ListConnections", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListConnections", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async", - "title": "RepositoryManager updateConnection Sample", - "origin": "API_DEFINITION", - "description": " Updates a single connection.", - "canonical": true, - "file": "repository_manager.update_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", - "async": true, - "parameters": [ - { - "name": "connection", - "type": ".google.devtools.cloudbuild.v2.Connection" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "UpdateConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.UpdateConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async", - "title": "RepositoryManager deleteConnection Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single connection.", - "canonical": true, - "file": "repository_manager.delete_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "DeleteConnection", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteConnection", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_CreateRepository_async", - "title": "RepositoryManager createRepository Sample", - "origin": "API_DEFINITION", - "description": " Creates a Repository.", - "canonical": true, - "file": "repository_manager.create_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "repository", - "type": ".google.devtools.cloudbuild.v2.Repository" - }, - { - "name": "repository_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "CreateRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.CreateRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async", - "title": "RepositoryManager batchCreateRepositories Sample", - "origin": "API_DEFINITION", - "description": " Creates multiple repositories inside a connection.", - "canonical": true, - "file": "repository_manager.batch_create_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "BatchCreateRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.BatchCreateRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_GetRepository_async", - "title": "RepositoryManager getRepository Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single repository.", - "canonical": true, - "file": "repository_manager.get_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.Repository", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "GetRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.GetRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_ListRepositories_async", - "title": "RepositoryManager listRepositories Sample", - "origin": "API_DEFINITION", - "description": " Lists Repositories in a given connection.", - "canonical": true, - "file": "repository_manager.list_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.ListRepositoriesResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "ListRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.ListRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async", - "title": "RepositoryManager deleteRepository Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single repository.", - "canonical": true, - "file": "repository_manager.delete_repository.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "DeleteRepository", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.DeleteRepository", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async", - "title": "RepositoryManager fetchReadWriteToken Sample", - "origin": "API_DEFINITION", - "description": " Fetches read/write token of a given repository.", - "canonical": true, - "file": "repository_manager.fetch_read_write_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchReadWriteToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchReadWriteToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadWriteToken", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async", - "title": "RepositoryManager fetchReadToken Sample", - "origin": "API_DEFINITION", - "description": " Fetches read token of a given repository.", - "canonical": true, - "file": "repository_manager.fetch_read_token.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchReadToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchReadTokenResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchReadToken", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchReadToken", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async", - "title": "RepositoryManager fetchLinkableRepositories Sample", - "origin": "API_DEFINITION", - "description": " FetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.", - "canonical": true, - "file": "repository_manager.fetch_linkable_repositories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchLinkableRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", - "async": true, - "parameters": [ - { - "name": "connection", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchLinkableRepositoriesResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchLinkableRepositories", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchLinkableRepositories", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - }, - { - "regionTag": "cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async", - "title": "RepositoryManager fetchGitRefs Sample", - "origin": "API_DEFINITION", - "description": " Fetch the list of branches or tags for a given repository.", - "canonical": true, - "file": "repository_manager.fetch_git_refs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchGitRefs", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", - "async": true, - "parameters": [ - { - "name": "repository", - "type": "TYPE_STRING" - }, - { - "name": "ref_type", - "type": ".google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType" - } - ], - "resultType": ".google.devtools.cloudbuild.v2.FetchGitRefsResponse", - "client": { - "shortName": "RepositoryManagerClient", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManagerClient" - }, - "method": { - "shortName": "FetchGitRefs", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager.FetchGitRefs", - "service": { - "shortName": "RepositoryManager", - "fullName": "google.devtools.cloudbuild.v2.RepositoryManager" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts deleted file mode 100644 index 87935397b2a..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 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 v2 from './v2'; -const RepositoryManagerClient = v2.RepositoryManagerClient; -type RepositoryManagerClient = v2.RepositoryManagerClient; -export {v2, RepositoryManagerClient}; -export default {v2, RepositoryManagerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json deleted file mode 100644 index e99fba47b64..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.devtools.cloudbuild.v2", - "libraryPackage": "@google-cloud/cloudbuild", - "services": { - "RepositoryManager": { - "clients": { - "grpc": { - "libraryClient": "RepositoryManagerClient", - "rpcs": { - "GetConnection": { - "methods": [ - "getConnection" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "FetchReadWriteToken": { - "methods": [ - "fetchReadWriteToken" - ] - }, - "FetchReadToken": { - "methods": [ - "fetchReadToken" - ] - }, - "FetchGitRefs": { - "methods": [ - "fetchGitRefs" - ] - }, - "CreateConnection": { - "methods": [ - "createConnection" - ] - }, - "UpdateConnection": { - "methods": [ - "updateConnection" - ] - }, - "DeleteConnection": { - "methods": [ - "deleteConnection" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "BatchCreateRepositories": { - "methods": [ - "batchCreateRepositories" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "ListConnections": { - "methods": [ - "listConnections", - "listConnectionsStream", - "listConnectionsAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "FetchLinkableRepositories": { - "methods": [ - "fetchLinkableRepositories", - "fetchLinkableRepositoriesStream", - "fetchLinkableRepositoriesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "RepositoryManagerClient", - "rpcs": { - "GetConnection": { - "methods": [ - "getConnection" - ] - }, - "GetRepository": { - "methods": [ - "getRepository" - ] - }, - "FetchReadWriteToken": { - "methods": [ - "fetchReadWriteToken" - ] - }, - "FetchReadToken": { - "methods": [ - "fetchReadToken" - ] - }, - "FetchGitRefs": { - "methods": [ - "fetchGitRefs" - ] - }, - "CreateConnection": { - "methods": [ - "createConnection" - ] - }, - "UpdateConnection": { - "methods": [ - "updateConnection" - ] - }, - "DeleteConnection": { - "methods": [ - "deleteConnection" - ] - }, - "CreateRepository": { - "methods": [ - "createRepository" - ] - }, - "BatchCreateRepositories": { - "methods": [ - "batchCreateRepositories" - ] - }, - "DeleteRepository": { - "methods": [ - "deleteRepository" - ] - }, - "ListConnections": { - "methods": [ - "listConnections", - "listConnectionsStream", - "listConnectionsAsync" - ] - }, - "ListRepositories": { - "methods": [ - "listRepositories", - "listRepositoriesStream", - "listRepositoriesAsync" - ] - }, - "FetchLinkableRepositories": { - "methods": [ - "fetchLinkableRepositories", - "fetchLinkableRepositoriesStream", - "fetchLinkableRepositoriesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts deleted file mode 100644 index 026d90530f0..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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 {RepositoryManagerClient} from './repository_manager_client'; diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts deleted file mode 100644 index 9981fbf72b9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts +++ /dev/null @@ -1,2603 +0,0 @@ -// Copyright 2023 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/repository_manager_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './repository_manager_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages connections to source code repositories. - * @class - * @memberof v2 - */ -export class RepositoryManagerClient { - 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}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - repositoryManagerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RepositoryManagerClient. - * - * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new RepositoryManagerClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RepositoryManagerClient; - 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - connectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connections/{connection}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - repositoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}' - ), - secretVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{version}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}' - ), - }; - - // 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 = { - listConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connections'), - listRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories'), - fetchLinkableRepositories: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'repositories') - }; - - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v2/{resource=projects/*/locations/*/connections/*}:getIamPolicy',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v2/{resource=projects/*/locations/*/connections/*}:setIamPolicy',body: '*',},{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v2/{resource=projects/*/locations/*/connections/*}:testIamPermissions',body: '*',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/locations/*/operations/*}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectionResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; - const createConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const updateConnectionResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Connection') as gax.protobuf.Type; - const updateConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const deleteConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectionMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const createRepositoryResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.Repository') as gax.protobuf.Type; - const createRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const batchCreateRepositoriesResponse = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.BatchCreateRepositoriesResponse') as gax.protobuf.Type; - const batchCreateRepositoriesMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - const deleteRepositoryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRepositoryMetadata = protoFilesRoot.lookup( - '.google.devtools.cloudbuild.v2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectionResponse.decode.bind(createConnectionResponse), - createConnectionMetadata.decode.bind(createConnectionMetadata)), - updateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectionResponse.decode.bind(updateConnectionResponse), - updateConnectionMetadata.decode.bind(updateConnectionMetadata)), - deleteConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectionResponse.decode.bind(deleteConnectionResponse), - deleteConnectionMetadata.decode.bind(deleteConnectionMetadata)), - createRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRepositoryResponse.decode.bind(createRepositoryResponse), - createRepositoryMetadata.decode.bind(createRepositoryMetadata)), - batchCreateRepositories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchCreateRepositoriesResponse.decode.bind(batchCreateRepositoriesResponse), - batchCreateRepositoriesMetadata.decode.bind(batchCreateRepositoriesMetadata)), - deleteRepository: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRepositoryResponse.decode.bind(deleteRepositoryResponse), - deleteRepositoryMetadata.decode.bind(deleteRepositoryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.devtools.cloudbuild.v2.RepositoryManager', 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 = this._gaxModule.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.repositoryManagerStub) { - return this.repositoryManagerStub; - } - - // Put together the "service stub" for - // google.devtools.cloudbuild.v2.RepositoryManager. - this.repositoryManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devtools.cloudbuild.v2.RepositoryManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devtools.cloudbuild.v2.RepositoryManager, - 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 repositoryManagerStubMethods = - ['createConnection', 'getConnection', 'listConnections', 'updateConnection', 'deleteConnection', 'createRepository', 'batchCreateRepositories', 'getRepository', 'listRepositories', 'deleteRepository', 'fetchReadWriteToken', 'fetchReadToken', 'fetchLinkableRepositories', 'fetchGitRefs']; - for (const methodName of repositoryManagerStubMethods) { - const callPromise = this.repositoryManagerStub.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._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.repositoryManagerStub; - } - - /** - * 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 -- - // ------------------- -/** - * Gets details of a single connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Connection to retrieve. - * Format: `projects/* /locations/* /connections/*`. - * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection}. - * 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/v2/repository_manager.get_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_GetConnection_async - */ - getConnection( - request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|undefined, {}|undefined - ]>; - getConnection( - request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): void; - getConnection( - request: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): void; - getConnection( - request?: protos.google.devtools.cloudbuild.v2.IGetConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection, - protos.google.devtools.cloudbuild.v2.IGetConnectionRequest|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConnection(request, options, callback); - } -/** - * Gets details of a single repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Repository to retrieve. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. - * 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/v2/repository_manager.get_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_GetRepository_async - */ - getRepository( - request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|undefined, {}|undefined - ]>; - getRepository( - request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): void; - getRepository( - request?: protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository, - protos.google.devtools.cloudbuild.v2.IGetRepositoryRequest|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRepository(request, options, callback); - } -/** - * Fetches read/write token of a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @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 {@link google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse | FetchReadWriteTokenResponse}. - * 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/v2/repository_manager.fetch_read_write_token.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadWriteToken_async - */ - fetchReadWriteToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|undefined, {}|undefined - ]>; - fetchReadWriteToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadWriteToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadWriteToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenRequest|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchReadWriteToken(request, options, callback); - } -/** - * Fetches read token of a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @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 {@link google.devtools.cloudbuild.v2.FetchReadTokenResponse | FetchReadTokenResponse}. - * 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/v2/repository_manager.fetch_read_token.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchReadToken_async - */ - fetchReadToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|undefined, {}|undefined - ]>; - fetchReadToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadToken( - request: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): void; - fetchReadToken( - request?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse, - protos.google.devtools.cloudbuild.v2.IFetchReadTokenRequest|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchReadToken(request, options, callback); - } -/** - * Fetch the list of branches or tags for a given repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.repository - * Required. The resource name of the repository in the format - * `projects/* /locations/* /connections/* /repositories/*`. - * @param {google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType} request.refType - * Type of refs to fetch - * @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 {@link google.devtools.cloudbuild.v2.FetchGitRefsResponse | FetchGitRefsResponse}. - * 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/v2/repository_manager.fetch_git_refs.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchGitRefs_async - */ - fetchGitRefs( - request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|undefined, {}|undefined - ]>; - fetchGitRefs( - request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - options: CallOptions, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): void; - fetchGitRefs( - request: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - callback: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): void; - fetchGitRefs( - request?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse, - protos.google.devtools.cloudbuild.v2.IFetchGitRefsRequest|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'repository': request.repository ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchGitRefs(request, options, callback); - } - -/** - * Creates a Connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project and location where the connection will be created. - * Format: `projects/* /locations/*`. - * @param {google.devtools.cloudbuild.v2.Connection} request.connection - * Required. The Connection to create. - * @param {string} request.connectionId - * Required. The ID to use for the Connection, which will become the final - * component of the Connection's resource name. Names must be unique - * per-project per-location. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - * @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/v2/repository_manager.create_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async - */ - createConnection( - request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnection( - request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnection( - request: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnection( - request?: protos.google.devtools.cloudbuild.v2.ICreateConnectionRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnection()`. - * @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/v2/repository_manager.create_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateConnection_async - */ - async checkCreateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devtools.cloudbuild.v2.Connection} request.connection - * Required. The Connection to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @param {boolean} request.allowMissing - * If set to true, and the connection is not found a new connection - * will be created. In this situation `update_mask` is ignored. - * The creation will succeed only if the input connection has all the - * necessary information (e.g a github_config with both user_oauth_token and - * installation_id properties). - * @param {string} request.etag - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, update will be blocked and an ABORTED error will be returned. - * @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/v2/repository_manager.update_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async - */ - updateConnection( - request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnection( - request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnection( - request: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnection( - request?: protos.google.devtools.cloudbuild.v2.IUpdateConnectionRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection.name': request.connection!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnection()`. - * @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/v2/repository_manager.update_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_UpdateConnection_async - */ - async checkUpdateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Connection to delete. - * Format: `projects/* /locations/* /connections/*`. - * @param {string} request.etag - * The current etag of the connection. - * If an etag is provided and does not match the current etag of the - * connection, deletion will be blocked and an ABORTED error will be returned. - * @param {boolean} request.validateOnly - * If set, validate the request, 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/v2/repository_manager.delete_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async - */ - deleteConnection( - request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnection( - request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnection( - request: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnection( - request?: protos.google.devtools.cloudbuild.v2.IDeleteConnectionRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnection()`. - * @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/v2/repository_manager.delete_connection.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteConnection_async - */ - async checkDeleteConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a Repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The connection to contain the repository. If the request is part - * of a BatchCreateRepositoriesRequest, this field should be empty or match - * the parent specified there. - * @param {google.devtools.cloudbuild.v2.Repository} request.repository - * Required. The repository to create. - * @param {string} request.repositoryId - * Required. The ID to use for the repository, which will become the final - * component of the repository's resource name. This ID should be unique in - * the connection. Allows alphanumeric characters and any of - * -._~%!$&'()*+,;=@. - * @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/v2/repository_manager.create_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async - */ - createRepository( - request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRepository( - request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRepository( - request?: protos.google.devtools.cloudbuild.v2.ICreateRepositoryRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRepository()`. - * @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/v2/repository_manager.create_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_CreateRepository_async - */ - async checkCreateRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates multiple repositories inside a connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The connection to contain all the repositories being created. - * Format: projects/* /locations/* /connections/* - * The parent field in the CreateRepositoryRequest messages - * must either be empty or match this field. - * @param {number[]} request.requests - * Required. The request messages specifying the repositories 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/v2/repository_manager.batch_create_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async - */ - batchCreateRepositories( - request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchCreateRepositories( - request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateRepositories( - request: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchCreateRepositories( - request?: protos.google.devtools.cloudbuild.v2.IBatchCreateRepositoriesRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateRepositories(request, options, callback); - } -/** - * Check the status of the long running operation returned by `batchCreateRepositories()`. - * @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/v2/repository_manager.batch_create_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_BatchCreateRepositories_async - */ - async checkBatchCreateRepositoriesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateRepositories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single repository. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Repository to delete. - * Format: `projects/* /locations/* /connections/* /repositories/*`. - * @param {string} request.etag - * The current etag of the repository. - * If an etag is provided and does not match the current etag of the - * repository, deletion will be blocked and an ABORTED error will be returned. - * @param {boolean} request.validateOnly - * If set, validate the request, 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/v2/repository_manager.delete_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async - */ - deleteRepository( - request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRepository( - request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRepository( - request?: protos.google.devtools.cloudbuild.v2.IDeleteRepositoryRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRepository(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRepository()`. - * @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/v2/repository_manager.delete_repository.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_DeleteRepository_async - */ - async checkDeleteRepositoryProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRepository, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Connections in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection}. - * 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 `listConnectionsAsync()` - * 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. - */ - listConnections( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection[], - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse - ]>; - listConnections( - request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): void; - listConnections( - request: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): void; - listConnections( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IConnection>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IConnection[], - protos.google.devtools.cloudbuild.v2.IListConnectionsRequest|null, - protos.google.devtools.cloudbuild.v2.IListConnectionsResponse - ]>|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConnections(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, which owns this collection of Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @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 {@link google.devtools.cloudbuild.v2.Connection | Connection} 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 `listConnectionsAsync()` - * 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. - */ - listConnectionsStream( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnections.createStream( - this.innerApiCalls.listConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnections`, 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, which owns this collection of Connections. - * Format: `projects/* /locations/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @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 - * {@link google.devtools.cloudbuild.v2.Connection | Connection}. 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/v2/repository_manager.list_connections.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_ListConnections_async - */ - listConnectionsAsync( - request?: protos.google.devtools.cloudbuild.v2.IListConnectionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnections.asyncIterate( - this.innerApiCalls['listConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists Repositories in a given connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. - * 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 `listRepositoriesAsync()` - * 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. - */ - listRepositories( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse - ]>; - listRepositories( - request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - listRepositories( - request: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - listRepositories( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IListRepositoriesResponse - ]>|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRepositories(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, which owns this collection of Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository} 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 `listRepositoriesAsync()` - * 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. - */ - listRepositoriesStream( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.createStream( - this.innerApiCalls.listRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRepositories`, 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, which owns this collection of Repositories. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Page start. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * Expressions must follow API improvement proposal - * [AIP-160](https://google.aip.dev/160). e.g. - * `remote_uri:"https://github.com*"`. - * @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 - * {@link google.devtools.cloudbuild.v2.Repository | Repository}. 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/v2/repository_manager.list_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_ListRepositories_async - */ - listRepositoriesAsync( - request?: protos.google.devtools.cloudbuild.v2.IListRepositoriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRepositories.asyncIterate( - this.innerApiCalls['listRepositories'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * FetchLinkableRepositories get repositories from SCM that are - * accessible and could be added to the connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository}. - * 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 `fetchLinkableRepositoriesAsync()` - * 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. - */ - fetchLinkableRepositories( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options?: CallOptions): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse - ]>; - fetchLinkableRepositories( - request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - fetchLinkableRepositories( - request: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - callback: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): void; - fetchLinkableRepositories( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>, - callback?: PaginationCallback< - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse|null|undefined, - protos.google.devtools.cloudbuild.v2.IRepository>): - Promise<[ - protos.google.devtools.cloudbuild.v2.IRepository[], - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest|null, - protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesResponse - ]>|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' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection': request.connection ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchLinkableRepositories(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.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @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 {@link google.devtools.cloudbuild.v2.Repository | Repository} 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 `fetchLinkableRepositoriesAsync()` - * 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. - */ - fetchLinkableRepositoriesStream( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection': request.connection ?? '', - }); - const defaultCallSettings = this._defaults['fetchLinkableRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchLinkableRepositories.createStream( - this.innerApiCalls.fetchLinkableRepositories as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `fetchLinkableRepositories`, 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.connection - * Required. The name of the Connection. - * Format: `projects/* /locations/* /connections/*`. - * @param {number} request.pageSize - * Number of results to return in the list. Default to 20. - * @param {string} request.pageToken - * Page start. - * @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 - * {@link google.devtools.cloudbuild.v2.Repository | Repository}. 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/v2/repository_manager.fetch_linkable_repositories.js - * region_tag:cloudbuild_v2_generated_RepositoryManager_FetchLinkableRepositories_async - */ - fetchLinkableRepositoriesAsync( - request?: protos.google.devtools.cloudbuild.v2.IFetchLinkableRepositoriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection': request.connection ?? '', - }); - const defaultCallSettings = this._defaults['fetchLinkableRepositories']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchLinkableRepositories.asyncIterate( - this.innerApiCalls['fetchLinkableRepositories'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @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 {@link google.cloud.location.Location | Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * {@link google.cloud.location.Location | Location}. 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 - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified connection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection - * @returns {string} Resource name string. - */ - connectionPath(project:string,location:string,connection:string) { - return this.pathTemplates.connectionPathTemplate.render({ - project: project, - location: location, - connection: connection, - }); - } - - /** - * Parse the project from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).project; - } - - /** - * Parse the location from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).location; - } - - /** - * Parse the connection from Connection resource. - * - * @param {string} connectionName - * A fully-qualified path representing Connection resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromConnectionName(connectionName: string) { - return this.pathTemplates.connectionPathTemplate.match(connectionName).connection; - } - - /** - * 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 repository resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection - * @param {string} repository - * @returns {string} Resource name string. - */ - repositoryPath(project:string,location:string,connection:string,repository:string) { - return this.pathTemplates.repositoryPathTemplate.render({ - project: project, - location: location, - connection: connection, - repository: repository, - }); - } - - /** - * Parse the project from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).project; - } - - /** - * Parse the location from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).location; - } - - /** - * Parse the connection from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the connection. - */ - matchConnectionFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).connection; - } - - /** - * Parse the repository from Repository resource. - * - * @param {string} repositoryName - * A fully-qualified path representing Repository resource. - * @returns {string} A string representing the repository. - */ - matchRepositoryFromRepositoryName(repositoryName: string) { - return this.pathTemplates.repositoryPathTemplate.match(repositoryName).repository; - } - - /** - * 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 service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} namespace - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,namespace:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - namespace: namespace, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the namespace from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the namespace. - */ - matchNamespaceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).namespace; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * 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.repositoryManagerStub && !this._terminated) { - return this.repositoryManagerStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json deleted file mode 100644 index 6049df136e9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "interfaces": { - "google.devtools.cloudbuild.v2.RepositoryManager": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetConnection": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListConnections": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateRepositories": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRepository": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListRepositories": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteRepository": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FetchReadWriteToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchReadToken": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchLinkableRepositories": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchGitRefs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json deleted file mode 100644 index 12097f770a6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/devtools/cloudbuild/v2/cloudbuild.proto", - "../../protos/google/devtools/cloudbuild/v2/repositories.proto" -] diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 20dca8dade6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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 repositoryManagerClient = new cloudbuild.RepositoryManagerClient(); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8c673824940..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 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 {RepositoryManagerClient} from '@google-cloud/cloudbuild'; - -// check that the client class type name can be used -function doStuffWithRepositoryManagerClient(client: RepositoryManagerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const repositoryManagerClient = new RepositoryManagerClient(); - doStuffWithRepositoryManagerClient(repositoryManagerClient); -} - -main(); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 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/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts deleted file mode 100644 index da45ca63502..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts +++ /dev/null @@ -1,3384 +0,0 @@ -// Copyright 2023 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 repositorymanagerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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('v2.RepositoryManagerClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = repositorymanagerModule.v2.RepositoryManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = repositorymanagerModule.v2.RepositoryManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = repositorymanagerModule.v2.RepositoryManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.repositoryManagerStub, undefined); - await client.initialize(); - assert(client.repositoryManagerStub); - }); - - it('has close method for the initialized client', done => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.repositoryManagerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.repositoryManagerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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('getConnection', () => { - it('invokes getConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Connection() - ); - client.innerApiCalls.getConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Connection() - ); - client.innerApiCalls.getConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnection( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnection with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnection(request), expectedError); - }); - }); - - describe('getRepository', () => { - it('invokes getRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCall(expectedResponse); - const [response] = await client.getRepository(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.Repository() - ); - client.innerApiCalls.getRepository = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRepository( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRepository = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRepository with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.GetRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.GetRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRepository(request), expectedError); - }); - }); - - describe('fetchReadWriteToken', () => { - it('invokes fetchReadWriteToken without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() - ); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(expectedResponse); - const [response] = await client.fetchReadWriteToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse() - ); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchReadWriteToken( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadWriteTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchReadWriteToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchReadWriteToken(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadWriteToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadWriteToken with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchReadWriteToken(request), expectedError); - }); - }); - - describe('fetchReadToken', () => { - it('invokes fetchReadToken without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() - ); - client.innerApiCalls.fetchReadToken = stubSimpleCall(expectedResponse); - const [response] = await client.fetchReadToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenResponse() - ); - client.innerApiCalls.fetchReadToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchReadToken( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchReadTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchReadToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchReadToken(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchReadToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchReadToken with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchReadTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchReadTokenRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchReadToken(request), expectedError); - }); - }); - - describe('fetchGitRefs', () => { - it('invokes fetchGitRefs without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() - ); - client.innerApiCalls.fetchGitRefs = stubSimpleCall(expectedResponse); - const [response] = await client.fetchGitRefs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsResponse() - ); - client.innerApiCalls.fetchGitRefs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchGitRefs( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IFetchGitRefsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedHeaderRequestParams = `repository=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchGitRefs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchGitRefs(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchGitRefs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchGitRefs with closed client', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchGitRefsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchGitRefsRequest', ['repository']); - request.repository = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.fetchGitRefs(request), expectedError); - }); - }); - - describe('createConnection', () => { - it('invokes createConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnection( - 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); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkCreateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkCreateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnection', () => { - it('invokes updateConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnection( - 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); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.UpdateConnectionRequest() - ); - request.connection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.UpdateConnectionRequest', ['connection', 'name']); - request.connection.name = defaultValue1; - const expectedHeaderRequestParams = `connection.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkUpdateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkUpdateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnection', () => { - it('invokes deleteConnection without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnection( - 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); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnection with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectionProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkDeleteConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectionProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkDeleteConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRepository', () => { - it('invokes createRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRepository( - 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); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRepository with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.CreateRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.CreateRepositoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRepositoryProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkCreateRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRepositoryProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkCreateRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('batchCreateRepositories', () => { - it('invokes batchCreateRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchCreateRepositories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateRepositories( - 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); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateRepositories with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateRepositories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateRepositories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBatchCreateRepositoriesProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkBatchCreateRepositoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchCreateRepositoriesProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkBatchCreateRepositoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRepository', () => { - it('invokes deleteRepository without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRepository(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRepository = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRepository( - 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); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with call error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRepository(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRepository with LRO error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.DeleteRepositoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.DeleteRepositoryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRepository = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRepository(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRepository as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRepositoryProgress without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkDeleteRepositoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRepositoryProgress with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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.checkDeleteRepositoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnections', () => { - it('invokes listConnections without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.innerApiCalls.listConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnections without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.innerApiCalls.listConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnections( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnections with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionsStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.descriptors.page.listConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { - 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.listConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); - assert( - (client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectionsStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Connection[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Connection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnections, request)); - assert( - (client.descriptors.page.listConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnections without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Connection()), - ]; - client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; - const iterable = client.listConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnections with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRepositories', () => { - it('invokes listRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.listRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.listRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRepositoriesStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - 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.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRepositoriesStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRepositories, request)); - assert( - (client.descriptors.page.listRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - const iterable = client.listRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.ListRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.ListRepositoriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('fetchLinkableRepositories', () => { - it('invokes fetchLinkableRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(expectedResponse); - const [response] = await client.fetchLinkableRepositories(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositories without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchLinkableRepositories( - request, - (err?: Error|null, result?: protos.google.devtools.cloudbuild.v2.IRepository[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchLinkableRepositories = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchLinkableRepositories(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchLinkableRepositories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchLinkableRepositoriesStream without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchLinkableRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - 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.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); - assert( - (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes fetchLinkableRepositoriesStream with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchLinkableRepositories.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchLinkableRepositoriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devtools.cloudbuild.v2.Repository[] = []; - stream.on('data', (response: protos.google.devtools.cloudbuild.v2.Repository) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchLinkableRepositories, request)); - assert( - (client.descriptors.page.fetchLinkableRepositories.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchLinkableRepositories without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - generateSampleMessage(new protos.google.devtools.cloudbuild.v2.Repository()), - ]; - client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - const iterable = client.fetchLinkableRepositoriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchLinkableRepositories with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest', ['connection']); - request.connection = defaultValue1; - const expectedHeaderRequestParams = `connection=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchLinkableRepositories.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchLinkableRepositoriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devtools.cloudbuild.v2.IRepository[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchLinkableRepositories.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('connection', () => { - const fakePath = "/rendered/path/connection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection: "connectionValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectionPath', () => { - const result = client.connectionPath("projectValue", "locationValue", "connectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectionName', () => { - const result = client.matchProjectFromConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectionName', () => { - const result = client.matchLocationFromConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionFromConnectionName', () => { - const result = client.matchConnectionFromConnectionName(fakePath); - assert.strictEqual(result, "connectionValue"); - assert((client.pathTemplates.connectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - 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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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('repository', () => { - const fakePath = "/rendered/path/repository"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection: "connectionValue", - repository: "repositoryValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.repositoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.repositoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('repositoryPath', () => { - const result = client.repositoryPath("projectValue", "locationValue", "connectionValue", "repositoryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.repositoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRepositoryName', () => { - const result = client.matchProjectFromRepositoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRepositoryName', () => { - const result = client.matchLocationFromRepositoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionFromRepositoryName', () => { - const result = client.matchConnectionFromRepositoryName(fakePath); - assert.strictEqual(result, "connectionValue"); - assert((client.pathTemplates.repositoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRepositoryFromRepositoryName', () => { - const result = client.matchRepositoryFromRepositoryName(fakePath); - assert.strictEqual(result, "repositoryValue"); - assert((client.pathTemplates.repositoryPathTemplate.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 repositorymanagerModule.v2.RepositoryManagerClient({ - 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('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - namespace: "namespaceValue", - service: "serviceValue", - }; - const client = new repositorymanagerModule.v2.RepositoryManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "namespaceValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNamespaceFromServiceName', () => { - const result = client.matchNamespaceFromServiceName(fakePath); - assert.strictEqual(result, "namespaceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json b/owl-bot-staging/google-devtools-cloudbuild/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/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/google-devtools-cloudbuild/v2/webpack.config.js b/owl-bot-staging/google-devtools-cloudbuild/v2/webpack.config.js deleted file mode 100644 index 0c12d4dc6a9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/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: 'RepositoryManager', - filename: './repository-manager.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/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto b/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto index 703d54c02e2..b864bed355a 100644 --- a/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ b/packages/google-devtools-cloudbuild/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -1573,6 +1573,108 @@ message ApprovalResult { string url = 6 [(google.api.field_behavior) = OPTIONAL]; } +// GitRepoSource describes a repo and ref of a code repository. +message GitRepoSource { + // The URI of the repo (e.g. https://github.com/user/repo.git). + // Either `uri` or `repository` can be specified and is required. + string uri = 1; + + // The source of the SCM repo. + oneof source { + // The connected repository resource name, in the format + // `projects/*/locations/*/connections/*/repositories/*`. Either `uri` or + // `repository` can be specified and is required. + string repository = 6 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // The branch or tag to use. Must start with "refs/" (required). + string ref = 2; + + // See RepoType below. + GitFileSource.RepoType repo_type = 3; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + +// GitFileSource describes a file within a (possibly remote) code repository. +message GitFileSource { + // The type of the repo, since it may not be explicit from the `repo` field + // (e.g from a URL). + enum RepoType { + // The default, unknown repo type. Don't use it, instead use one of + // the other repo types. + UNKNOWN = 0; + + // A Google Cloud Source Repositories-hosted repo. + CLOUD_SOURCE_REPOSITORIES = 1; + + // A GitHub-hosted repo not necessarily on "github.com" (i.e. GitHub + // Enterprise). + GITHUB = 2; + + // A Bitbucket Server-hosted repo. + BITBUCKET_SERVER = 3; + + // A GitLab-hosted repo. + GITLAB = 4; + } + + // The path of the file, with the repo root as the root of the path. + string path = 1; + + // The URI of the repo. + // Either uri or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string uri = 2; + + // The source of the SCM repo. + oneof source { + // The fully qualified resource name of the Repos API repository. + // Either URI or repository can be specified. + // If unspecified, the repo from which the trigger invocation originated is + // assumed to be the repo from which to read the specified path. + string repository = 7 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Repository" + }]; + } + + // See RepoType above. + RepoType repo_type = 3; + + // The branch, tag, arbitrary ref, or SHA version of the repo to use when + // resolving the filename (optional). + // This field respects the same syntax/resolution as described here: + // https://git-scm.com/docs/gitrevisions + // If unspecified, the revision from which the trigger invocation originated + // is assumed to be the revision from which to read the specified path. + string revision = 4; + + // The resource name of the enterprise config that should be applied + // to this source. + oneof enterprise_config { + // The full resource name of the github enterprise config. + // Format: + // `projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}`. + // `projects/{project}/githubEnterpriseConfigs/{id}`. + string github_enterprise_config = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + }]; + } +} + // Configuration for an automated build in response to source repository // changes. message BuildTrigger { @@ -1649,6 +1751,9 @@ message BuildTrigger { // Path, from the source root, to the build configuration file // (i.e. cloudbuild.yaml). string filename = 8; + + // The file source describing the local or remote Build template. + GitFileSource git_file_source = 24; } // Output only. Time when the trigger was created. @@ -1686,6 +1791,14 @@ message BuildTrigger { // Optional. A Common Expression Language string. string filter = 30 [(google.api.field_behavior) = OPTIONAL]; + // The repo and ref of the repository from which to build. This field + // is used only for those triggers that do not respond to SCM events. + // Triggers that respond to such events build source at whatever commit + // caused the event. + // This field is currently only used by Webhook, Pub/Sub, Manual, and Cron + // triggers. + GitRepoSource source_to_build = 26; + // 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 @@ -2204,6 +2317,83 @@ message ReceiveTriggerWebhookRequest { // ReceiveTriggerWebhook method. message ReceiveTriggerWebhookResponse {} +message GitHubEnterpriseConfig { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/GithubEnterpriseConfig" + pattern: "projects/{project}/githubEnterpriseConfigs/{config}" + pattern: "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" + }; + + // Optional. The full resource name for the GitHubEnterpriseConfig + // For example: + // "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}" + string name = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The URL of the github enterprise host the configuration is for. + string host_url = 3; + + // Required. The GitHub app id of the Cloud Build app on the GitHub Enterprise + // server. + int64 app_id = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Time when the installation was associated with the project. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The key that should be attached to webhook calls to the ReceiveWebhook + // endpoint. + string webhook_key = 8; + + // Optional. The network to be used when reaching out to the GitHub + // Enterprise server. The VPC network must be enabled for private + // service connection. This should be set if the GitHub Enterprise server is + // hosted on-premises and not reachable by public internet. + // If this field is left empty, no network peering will occur and calls to + // the GitHub Enterprise server will be made over the public internet. + // Must be in the format + // `projects/{project}/global/networks/{network}`, where {project} + // is a project number or id and {network} is the name of a + // VPC network in the project. + string peered_network = 9 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Names of secrets in Secret Manager. + GitHubEnterpriseSecrets secrets = 10; + + // Name to display for this config. + string display_name = 11; + + // Optional. SSL certificate to use for requests to GitHub Enterprise. + string ssl_ca = 12 [(google.api.field_behavior) = OPTIONAL]; +} + +// GitHubEnterpriseSecrets represents the names of all necessary secrets in +// Secret Manager for a GitHub Enterprise server. +// Format is: projects//secrets/. +message GitHubEnterpriseSecrets { + // The resource name for the private key secret version. + string private_key_version_name = 5 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the webhook secret secret version in Secret Manager. + string webhook_secret_version_name = 6 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth secret secret version in Secret Manager. + string oauth_secret_version_name = 7 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // The resource name for the OAuth client ID secret version in Secret Manager. + string oauth_client_id_version_name = 8 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; +} + // Configuration for a `WorkerPool`. // // Cloud Build owns and maintains a pool of workers for general use and have no diff --git a/packages/google-devtools-cloudbuild/protos/protos.d.ts b/packages/google-devtools-cloudbuild/protos/protos.d.ts index ae329e5f97d..3ba5677c8a6 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.d.ts +++ b/packages/google-devtools-cloudbuild/protos/protos.d.ts @@ -5233,6 +5233,278 @@ export namespace google { } } + /** Properties of a GitRepoSource. */ + interface IGitRepoSource { + + /** GitRepoSource uri */ + uri?: (string|null); + + /** GitRepoSource repository */ + repository?: (string|null); + + /** GitRepoSource ref */ + ref?: (string|null); + + /** GitRepoSource repoType */ + repoType?: (google.devtools.cloudbuild.v1.GitFileSource.RepoType|keyof typeof google.devtools.cloudbuild.v1.GitFileSource.RepoType|null); + + /** GitRepoSource githubEnterpriseConfig */ + githubEnterpriseConfig?: (string|null); + } + + /** Represents a GitRepoSource. */ + class GitRepoSource implements IGitRepoSource { + + /** + * Constructs a new GitRepoSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IGitRepoSource); + + /** GitRepoSource uri. */ + public uri: string; + + /** GitRepoSource repository. */ + public repository?: (string|null); + + /** GitRepoSource ref. */ + public ref: string; + + /** GitRepoSource repoType. */ + public repoType: (google.devtools.cloudbuild.v1.GitFileSource.RepoType|keyof typeof google.devtools.cloudbuild.v1.GitFileSource.RepoType); + + /** GitRepoSource githubEnterpriseConfig. */ + public githubEnterpriseConfig?: (string|null); + + /** GitRepoSource source. */ + public source?: "repository"; + + /** GitRepoSource enterpriseConfig. */ + public enterpriseConfig?: "githubEnterpriseConfig"; + + /** + * Creates a new GitRepoSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GitRepoSource instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IGitRepoSource): google.devtools.cloudbuild.v1.GitRepoSource; + + /** + * Encodes the specified GitRepoSource message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitRepoSource.verify|verify} messages. + * @param message GitRepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IGitRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GitRepoSource message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitRepoSource.verify|verify} messages. + * @param message GitRepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IGitRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GitRepoSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GitRepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudbuild.v1.GitRepoSource; + + /** + * Decodes a GitRepoSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GitRepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudbuild.v1.GitRepoSource; + + /** + * Verifies a GitRepoSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GitRepoSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GitRepoSource + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.GitRepoSource; + + /** + * Creates a plain object from a GitRepoSource message. Also converts values to other types if specified. + * @param message GitRepoSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.GitRepoSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GitRepoSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GitRepoSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GitFileSource. */ + interface IGitFileSource { + + /** GitFileSource path */ + path?: (string|null); + + /** GitFileSource uri */ + uri?: (string|null); + + /** GitFileSource repository */ + repository?: (string|null); + + /** GitFileSource repoType */ + repoType?: (google.devtools.cloudbuild.v1.GitFileSource.RepoType|keyof typeof google.devtools.cloudbuild.v1.GitFileSource.RepoType|null); + + /** GitFileSource revision */ + revision?: (string|null); + + /** GitFileSource githubEnterpriseConfig */ + githubEnterpriseConfig?: (string|null); + } + + /** Represents a GitFileSource. */ + class GitFileSource implements IGitFileSource { + + /** + * Constructs a new GitFileSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IGitFileSource); + + /** GitFileSource path. */ + public path: string; + + /** GitFileSource uri. */ + public uri: string; + + /** GitFileSource repository. */ + public repository?: (string|null); + + /** GitFileSource repoType. */ + public repoType: (google.devtools.cloudbuild.v1.GitFileSource.RepoType|keyof typeof google.devtools.cloudbuild.v1.GitFileSource.RepoType); + + /** GitFileSource revision. */ + public revision: string; + + /** GitFileSource githubEnterpriseConfig. */ + public githubEnterpriseConfig?: (string|null); + + /** GitFileSource source. */ + public source?: "repository"; + + /** GitFileSource enterpriseConfig. */ + public enterpriseConfig?: "githubEnterpriseConfig"; + + /** + * Creates a new GitFileSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GitFileSource instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IGitFileSource): google.devtools.cloudbuild.v1.GitFileSource; + + /** + * Encodes the specified GitFileSource message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitFileSource.verify|verify} messages. + * @param message GitFileSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IGitFileSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GitFileSource message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitFileSource.verify|verify} messages. + * @param message GitFileSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IGitFileSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GitFileSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GitFileSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudbuild.v1.GitFileSource; + + /** + * Decodes a GitFileSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GitFileSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudbuild.v1.GitFileSource; + + /** + * Verifies a GitFileSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GitFileSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GitFileSource + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.GitFileSource; + + /** + * Creates a plain object from a GitFileSource message. Also converts values to other types if specified. + * @param message GitFileSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.GitFileSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GitFileSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GitFileSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GitFileSource { + + /** RepoType enum. */ + enum RepoType { + UNKNOWN = 0, + CLOUD_SOURCE_REPOSITORIES = 1, + GITHUB = 2, + BITBUCKET_SERVER = 3, + GITLAB = 4 + } + } + /** Properties of a BuildTrigger. */ interface IBuildTrigger { @@ -5272,6 +5544,9 @@ export namespace google { /** BuildTrigger filename */ filename?: (string|null); + /** BuildTrigger gitFileSource */ + gitFileSource?: (google.devtools.cloudbuild.v1.IGitFileSource|null); + /** BuildTrigger createTime */ createTime?: (google.protobuf.ITimestamp|null); @@ -5290,6 +5565,9 @@ export namespace google { /** BuildTrigger filter */ filter?: (string|null); + /** BuildTrigger sourceToBuild */ + sourceToBuild?: (google.devtools.cloudbuild.v1.IGitRepoSource|null); + /** BuildTrigger serviceAccount */ serviceAccount?: (string|null); @@ -5342,6 +5620,9 @@ export namespace google { /** BuildTrigger filename. */ public filename?: (string|null); + /** BuildTrigger gitFileSource. */ + public gitFileSource?: (google.devtools.cloudbuild.v1.IGitFileSource|null); + /** BuildTrigger createTime. */ public createTime?: (google.protobuf.ITimestamp|null); @@ -5360,6 +5641,9 @@ export namespace google { /** BuildTrigger filter. */ public filter: string; + /** BuildTrigger sourceToBuild. */ + public sourceToBuild?: (google.devtools.cloudbuild.v1.IGitRepoSource|null); + /** BuildTrigger serviceAccount. */ public serviceAccount: string; @@ -5367,7 +5651,7 @@ export namespace google { public repositoryEventConfig?: (google.devtools.cloudbuild.v1.IRepositoryEventConfig|null); /** BuildTrigger buildTemplate. */ - public buildTemplate?: ("autodetect"|"build"|"filename"); + public buildTemplate?: ("autodetect"|"build"|"filename"|"gitFileSource"); /** * Creates a new BuildTrigger instance using the specified properties. @@ -7363,6 +7647,266 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a GitHubEnterpriseConfig. */ + interface IGitHubEnterpriseConfig { + + /** GitHubEnterpriseConfig name */ + name?: (string|null); + + /** GitHubEnterpriseConfig hostUrl */ + hostUrl?: (string|null); + + /** GitHubEnterpriseConfig appId */ + appId?: (number|Long|string|null); + + /** GitHubEnterpriseConfig createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** GitHubEnterpriseConfig webhookKey */ + webhookKey?: (string|null); + + /** GitHubEnterpriseConfig peeredNetwork */ + peeredNetwork?: (string|null); + + /** GitHubEnterpriseConfig secrets */ + secrets?: (google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets|null); + + /** GitHubEnterpriseConfig displayName */ + displayName?: (string|null); + + /** GitHubEnterpriseConfig sslCa */ + sslCa?: (string|null); + } + + /** Represents a GitHubEnterpriseConfig. */ + class GitHubEnterpriseConfig implements IGitHubEnterpriseConfig { + + /** + * Constructs a new GitHubEnterpriseConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig); + + /** GitHubEnterpriseConfig name. */ + public name: string; + + /** GitHubEnterpriseConfig hostUrl. */ + public hostUrl: string; + + /** GitHubEnterpriseConfig appId. */ + public appId: (number|Long|string); + + /** GitHubEnterpriseConfig createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** GitHubEnterpriseConfig webhookKey. */ + public webhookKey: string; + + /** GitHubEnterpriseConfig peeredNetwork. */ + public peeredNetwork: string; + + /** GitHubEnterpriseConfig secrets. */ + public secrets?: (google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets|null); + + /** GitHubEnterpriseConfig displayName. */ + public displayName: string; + + /** GitHubEnterpriseConfig sslCa. */ + public sslCa: string; + + /** + * Creates a new GitHubEnterpriseConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GitHubEnterpriseConfig instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig): google.devtools.cloudbuild.v1.GitHubEnterpriseConfig; + + /** + * Encodes the specified GitHubEnterpriseConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.verify|verify} messages. + * @param message GitHubEnterpriseConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GitHubEnterpriseConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.verify|verify} messages. + * @param message GitHubEnterpriseConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GitHubEnterpriseConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GitHubEnterpriseConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudbuild.v1.GitHubEnterpriseConfig; + + /** + * Decodes a GitHubEnterpriseConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GitHubEnterpriseConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudbuild.v1.GitHubEnterpriseConfig; + + /** + * Verifies a GitHubEnterpriseConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GitHubEnterpriseConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GitHubEnterpriseConfig + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.GitHubEnterpriseConfig; + + /** + * Creates a plain object from a GitHubEnterpriseConfig message. Also converts values to other types if specified. + * @param message GitHubEnterpriseConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.GitHubEnterpriseConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GitHubEnterpriseConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GitHubEnterpriseConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GitHubEnterpriseSecrets. */ + interface IGitHubEnterpriseSecrets { + + /** GitHubEnterpriseSecrets privateKeyVersionName */ + privateKeyVersionName?: (string|null); + + /** GitHubEnterpriseSecrets webhookSecretVersionName */ + webhookSecretVersionName?: (string|null); + + /** GitHubEnterpriseSecrets oauthSecretVersionName */ + oauthSecretVersionName?: (string|null); + + /** GitHubEnterpriseSecrets oauthClientIdVersionName */ + oauthClientIdVersionName?: (string|null); + } + + /** Represents a GitHubEnterpriseSecrets. */ + class GitHubEnterpriseSecrets implements IGitHubEnterpriseSecrets { + + /** + * Constructs a new GitHubEnterpriseSecrets. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets); + + /** GitHubEnterpriseSecrets privateKeyVersionName. */ + public privateKeyVersionName: string; + + /** GitHubEnterpriseSecrets webhookSecretVersionName. */ + public webhookSecretVersionName: string; + + /** GitHubEnterpriseSecrets oauthSecretVersionName. */ + public oauthSecretVersionName: string; + + /** GitHubEnterpriseSecrets oauthClientIdVersionName. */ + public oauthClientIdVersionName: string; + + /** + * Creates a new GitHubEnterpriseSecrets instance using the specified properties. + * @param [properties] Properties to set + * @returns GitHubEnterpriseSecrets instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets): google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets; + + /** + * Encodes the specified GitHubEnterpriseSecrets message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.verify|verify} messages. + * @param message GitHubEnterpriseSecrets message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GitHubEnterpriseSecrets message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.verify|verify} messages. + * @param message GitHubEnterpriseSecrets message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GitHubEnterpriseSecrets message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GitHubEnterpriseSecrets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets; + + /** + * Decodes a GitHubEnterpriseSecrets message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GitHubEnterpriseSecrets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets; + + /** + * Verifies a GitHubEnterpriseSecrets message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GitHubEnterpriseSecrets message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GitHubEnterpriseSecrets + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets; + + /** + * Creates a plain object from a GitHubEnterpriseSecrets message. Also converts values to other types if specified. + * @param message GitHubEnterpriseSecrets + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GitHubEnterpriseSecrets to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GitHubEnterpriseSecrets + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a WorkerPool. */ interface IWorkerPool { diff --git a/packages/google-devtools-cloudbuild/protos/protos.js b/packages/google-devtools-cloudbuild/protos/protos.js index fe73e75b68f..b9064ca52b4 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.js +++ b/packages/google-devtools-cloudbuild/protos/protos.js @@ -13423,47 +13423,28 @@ return ApprovalResult; })(); - v1.BuildTrigger = (function() { + v1.GitRepoSource = (function() { /** - * Properties of a BuildTrigger. + * Properties of a GitRepoSource. * @memberof google.devtools.cloudbuild.v1 - * @interface IBuildTrigger - * @property {string|null} [resourceName] BuildTrigger resourceName - * @property {string|null} [id] BuildTrigger id - * @property {string|null} [description] BuildTrigger description - * @property {string|null} [name] BuildTrigger name - * @property {Array.|null} [tags] BuildTrigger tags - * @property {google.devtools.cloudbuild.v1.IRepoSource|null} [triggerTemplate] BuildTrigger triggerTemplate - * @property {google.devtools.cloudbuild.v1.IGitHubEventsConfig|null} [github] BuildTrigger github - * @property {google.devtools.cloudbuild.v1.IPubsubConfig|null} [pubsubConfig] BuildTrigger pubsubConfig - * @property {google.devtools.cloudbuild.v1.IWebhookConfig|null} [webhookConfig] BuildTrigger webhookConfig - * @property {boolean|null} [autodetect] BuildTrigger autodetect - * @property {google.devtools.cloudbuild.v1.IBuild|null} [build] BuildTrigger build - * @property {string|null} [filename] BuildTrigger filename - * @property {google.protobuf.ITimestamp|null} [createTime] BuildTrigger createTime - * @property {boolean|null} [disabled] BuildTrigger disabled - * @property {Object.|null} [substitutions] BuildTrigger substitutions - * @property {Array.|null} [ignoredFiles] BuildTrigger ignoredFiles - * @property {Array.|null} [includedFiles] BuildTrigger includedFiles - * @property {string|null} [filter] BuildTrigger filter - * @property {string|null} [serviceAccount] BuildTrigger serviceAccount - * @property {google.devtools.cloudbuild.v1.IRepositoryEventConfig|null} [repositoryEventConfig] BuildTrigger repositoryEventConfig + * @interface IGitRepoSource + * @property {string|null} [uri] GitRepoSource uri + * @property {string|null} [repository] GitRepoSource repository + * @property {string|null} [ref] GitRepoSource ref + * @property {google.devtools.cloudbuild.v1.GitFileSource.RepoType|null} [repoType] GitRepoSource repoType + * @property {string|null} [githubEnterpriseConfig] GitRepoSource githubEnterpriseConfig */ /** - * Constructs a new BuildTrigger. + * Constructs a new GitRepoSource. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a BuildTrigger. - * @implements IBuildTrigger + * @classdesc Represents a GitRepoSource. + * @implements IGitRepoSource * @constructor - * @param {google.devtools.cloudbuild.v1.IBuildTrigger=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGitRepoSource=} [properties] Properties to set */ - function BuildTrigger(properties) { - this.tags = []; - this.substitutions = {}; - this.ignoredFiles = []; - this.includedFiles = []; + function GitRepoSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13471,384 +13452,156 @@ } /** - * BuildTrigger resourceName. - * @member {string} resourceName - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.resourceName = ""; - - /** - * BuildTrigger id. - * @member {string} id - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.id = ""; - - /** - * BuildTrigger description. - * @member {string} description - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.description = ""; - - /** - * BuildTrigger name. - * @member {string} name - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.name = ""; - - /** - * BuildTrigger tags. - * @member {Array.} tags - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.tags = $util.emptyArray; - - /** - * BuildTrigger triggerTemplate. - * @member {google.devtools.cloudbuild.v1.IRepoSource|null|undefined} triggerTemplate - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.triggerTemplate = null; - - /** - * BuildTrigger github. - * @member {google.devtools.cloudbuild.v1.IGitHubEventsConfig|null|undefined} github - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.github = null; - - /** - * BuildTrigger pubsubConfig. - * @member {google.devtools.cloudbuild.v1.IPubsubConfig|null|undefined} pubsubConfig - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.pubsubConfig = null; - - /** - * BuildTrigger webhookConfig. - * @member {google.devtools.cloudbuild.v1.IWebhookConfig|null|undefined} webhookConfig - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.webhookConfig = null; - - /** - * BuildTrigger autodetect. - * @member {boolean|null|undefined} autodetect - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.autodetect = null; - - /** - * BuildTrigger build. - * @member {google.devtools.cloudbuild.v1.IBuild|null|undefined} build - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.build = null; - - /** - * BuildTrigger filename. - * @member {string|null|undefined} filename - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.filename = null; - - /** - * BuildTrigger createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.createTime = null; - - /** - * BuildTrigger disabled. - * @member {boolean} disabled - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource uri. + * @member {string} uri + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.disabled = false; + GitRepoSource.prototype.uri = ""; /** - * BuildTrigger substitutions. - * @member {Object.} substitutions - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource repository. + * @member {string|null|undefined} repository + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.substitutions = $util.emptyObject; + GitRepoSource.prototype.repository = null; /** - * BuildTrigger ignoredFiles. - * @member {Array.} ignoredFiles - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource ref. + * @member {string} ref + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.ignoredFiles = $util.emptyArray; + GitRepoSource.prototype.ref = ""; /** - * BuildTrigger includedFiles. - * @member {Array.} includedFiles - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource repoType. + * @member {google.devtools.cloudbuild.v1.GitFileSource.RepoType} repoType + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.includedFiles = $util.emptyArray; + GitRepoSource.prototype.repoType = 0; /** - * BuildTrigger filter. - * @member {string} filter - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource githubEnterpriseConfig. + * @member {string|null|undefined} githubEnterpriseConfig + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.filter = ""; + GitRepoSource.prototype.githubEnterpriseConfig = null; - /** - * BuildTrigger serviceAccount. - * @member {string} serviceAccount - * @memberof google.devtools.cloudbuild.v1.BuildTrigger - * @instance - */ - BuildTrigger.prototype.serviceAccount = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * BuildTrigger repositoryEventConfig. - * @member {google.devtools.cloudbuild.v1.IRepositoryEventConfig|null|undefined} repositoryEventConfig - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource source. + * @member {"repository"|undefined} source + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - BuildTrigger.prototype.repositoryEventConfig = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + Object.defineProperty(GitRepoSource.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["repository"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * BuildTrigger buildTemplate. - * @member {"autodetect"|"build"|"filename"|undefined} buildTemplate - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * GitRepoSource enterpriseConfig. + * @member {"githubEnterpriseConfig"|undefined} enterpriseConfig + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance */ - Object.defineProperty(BuildTrigger.prototype, "buildTemplate", { - get: $util.oneOfGetter($oneOfFields = ["autodetect", "build", "filename"]), + Object.defineProperty(GitRepoSource.prototype, "enterpriseConfig", { + get: $util.oneOfGetter($oneOfFields = ["githubEnterpriseConfig"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new BuildTrigger instance using the specified properties. + * Creates a new GitRepoSource instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static - * @param {google.devtools.cloudbuild.v1.IBuildTrigger=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger instance + * @param {google.devtools.cloudbuild.v1.IGitRepoSource=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GitRepoSource} GitRepoSource instance */ - BuildTrigger.create = function create(properties) { - return new BuildTrigger(properties); + GitRepoSource.create = function create(properties) { + return new GitRepoSource(properties); }; /** - * Encodes the specified BuildTrigger message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildTrigger.verify|verify} messages. + * Encodes the specified GitRepoSource message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitRepoSource.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static - * @param {google.devtools.cloudbuild.v1.IBuildTrigger} message BuildTrigger message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitRepoSource} message GitRepoSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BuildTrigger.encode = function encode(message, writer) { + GitRepoSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.build != null && Object.hasOwnProperty.call(message, "build")) - $root.google.devtools.cloudbuild.v1.Build.encode(message.build, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.triggerTemplate != null && Object.hasOwnProperty.call(message, "triggerTemplate")) - $root.google.devtools.cloudbuild.v1.RepoSource.encode(message.triggerTemplate, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.filename != null && Object.hasOwnProperty.call(message, "filename")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.filename); - if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.disabled); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); - if (message.substitutions != null && Object.hasOwnProperty.call(message, "substitutions")) - for (var keys = Object.keys(message.substitutions), i = 0; i < keys.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.substitutions[keys[i]]).ldelim(); - if (message.github != null && Object.hasOwnProperty.call(message, "github")) - $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.encode(message.github, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.ignoredFiles != null && message.ignoredFiles.length) - for (var i = 0; i < message.ignoredFiles.length; ++i) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.ignoredFiles[i]); - if (message.includedFiles != null && message.includedFiles.length) - for (var i = 0; i < message.includedFiles.length; ++i) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.includedFiles[i]); - if (message.autodetect != null && Object.hasOwnProperty.call(message, "autodetect")) - writer.uint32(/* id 18, wireType 0 =*/144).bool(message.autodetect); - if (message.tags != null && message.tags.length) - for (var i = 0; i < message.tags.length; ++i) - writer.uint32(/* id 19, wireType 2 =*/154).string(message.tags[i]); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 21, wireType 2 =*/170).string(message.name); - if (message.pubsubConfig != null && Object.hasOwnProperty.call(message, "pubsubConfig")) - $root.google.devtools.cloudbuild.v1.PubsubConfig.encode(message.pubsubConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 30, wireType 2 =*/242).string(message.filter); - if (message.webhookConfig != null && Object.hasOwnProperty.call(message, "webhookConfig")) - $root.google.devtools.cloudbuild.v1.WebhookConfig.encode(message.webhookConfig, writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); - if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) - writer.uint32(/* id 33, wireType 2 =*/266).string(message.serviceAccount); - if (message.resourceName != null && Object.hasOwnProperty.call(message, "resourceName")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.resourceName); - if (message.repositoryEventConfig != null && Object.hasOwnProperty.call(message, "repositoryEventConfig")) - $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.encode(message.repositoryEventConfig, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.ref != null && Object.hasOwnProperty.call(message, "ref")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ref); + if (message.repoType != null && Object.hasOwnProperty.call(message, "repoType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repoType); + if (message.githubEnterpriseConfig != null && Object.hasOwnProperty.call(message, "githubEnterpriseConfig")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.githubEnterpriseConfig); + if (message.repository != null && Object.hasOwnProperty.call(message, "repository")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.repository); return writer; }; /** - * Encodes the specified BuildTrigger message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildTrigger.verify|verify} messages. + * Encodes the specified GitRepoSource message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitRepoSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static - * @param {google.devtools.cloudbuild.v1.IBuildTrigger} message BuildTrigger message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitRepoSource} message GitRepoSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BuildTrigger.encodeDelimited = function encodeDelimited(message, writer) { + GitRepoSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BuildTrigger message from the specified reader or buffer. + * Decodes a GitRepoSource message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger + * @returns {google.devtools.cloudbuild.v1.GitRepoSource} GitRepoSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BuildTrigger.decode = function decode(reader, length) { + GitRepoSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildTrigger(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitRepoSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 34: { - message.resourceName = reader.string(); + case 1: { + message.uri = reader.string(); break; } - case 1: { - message.id = reader.string(); + case 6: { + message.repository = reader.string(); break; } - case 10: { - message.description = reader.string(); + case 2: { + message.ref = reader.string(); break; } - case 21: { - message.name = reader.string(); - break; - } - case 19: { - if (!(message.tags && message.tags.length)) - message.tags = []; - message.tags.push(reader.string()); - break; - } - case 7: { - message.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.decode(reader, reader.uint32()); - break; - } - case 13: { - message.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.decode(reader, reader.uint32()); - break; - } - case 29: { - message.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.decode(reader, reader.uint32()); - break; - } - case 31: { - message.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.decode(reader, reader.uint32()); - break; - } - case 18: { - message.autodetect = reader.bool(); + case 3: { + message.repoType = reader.int32(); break; } case 4: { - message.build = $root.google.devtools.cloudbuild.v1.Build.decode(reader, reader.uint32()); - break; - } - case 8: { - message.filename = reader.string(); - break; - } - case 5: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 9: { - message.disabled = reader.bool(); - break; - } - case 11: { - if (message.substitutions === $util.emptyObject) - message.substitutions = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.substitutions[key] = value; - break; - } - case 15: { - if (!(message.ignoredFiles && message.ignoredFiles.length)) - message.ignoredFiles = []; - message.ignoredFiles.push(reader.string()); - break; - } - case 16: { - if (!(message.includedFiles && message.includedFiles.length)) - message.includedFiles = []; - message.includedFiles.push(reader.string()); - break; - } - case 30: { - message.filter = reader.string(); - break; - } - case 33: { - message.serviceAccount = reader.string(); - break; - } - case 39: { - message.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.decode(reader, reader.uint32()); + message.githubEnterpriseConfig = reader.string(); break; } default: @@ -13860,384 +13613,203 @@ }; /** - * Decodes a BuildTrigger message from the specified reader or buffer, length delimited. + * Decodes a GitRepoSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger + * @returns {google.devtools.cloudbuild.v1.GitRepoSource} GitRepoSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BuildTrigger.decodeDelimited = function decodeDelimited(reader) { + GitRepoSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BuildTrigger message. + * Verifies a GitRepoSource message. * @function verify - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BuildTrigger.verify = function verify(message) { + GitRepoSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.resourceName != null && message.hasOwnProperty("resourceName")) - if (!$util.isString(message.resourceName)) - return "resourceName: string expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!Array.isArray(message.tags)) - return "tags: array expected"; - for (var i = 0; i < message.tags.length; ++i) - if (!$util.isString(message.tags[i])) - return "tags: string[] expected"; - } - if (message.triggerTemplate != null && message.hasOwnProperty("triggerTemplate")) { - var error = $root.google.devtools.cloudbuild.v1.RepoSource.verify(message.triggerTemplate); - if (error) - return "triggerTemplate." + error; - } - if (message.github != null && message.hasOwnProperty("github")) { - var error = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.verify(message.github); - if (error) - return "github." + error; - } - if (message.pubsubConfig != null && message.hasOwnProperty("pubsubConfig")) { - var error = $root.google.devtools.cloudbuild.v1.PubsubConfig.verify(message.pubsubConfig); - if (error) - return "pubsubConfig." + error; - } - if (message.webhookConfig != null && message.hasOwnProperty("webhookConfig")) { - var error = $root.google.devtools.cloudbuild.v1.WebhookConfig.verify(message.webhookConfig); - if (error) - return "webhookConfig." + error; - } - if (message.autodetect != null && message.hasOwnProperty("autodetect")) { - properties.buildTemplate = 1; - if (typeof message.autodetect !== "boolean") - return "autodetect: boolean expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.repository != null && message.hasOwnProperty("repository")) { + properties.source = 1; + if (!$util.isString(message.repository)) + return "repository: string expected"; } - if (message.build != null && message.hasOwnProperty("build")) { - if (properties.buildTemplate === 1) - return "buildTemplate: multiple values"; - properties.buildTemplate = 1; - { - var error = $root.google.devtools.cloudbuild.v1.Build.verify(message.build); - if (error) - return "build." + error; + if (message.ref != null && message.hasOwnProperty("ref")) + if (!$util.isString(message.ref)) + return "ref: string expected"; + if (message.repoType != null && message.hasOwnProperty("repoType")) + switch (message.repoType) { + default: + return "repoType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; } - } - if (message.filename != null && message.hasOwnProperty("filename")) { - if (properties.buildTemplate === 1) - return "buildTemplate: multiple values"; - properties.buildTemplate = 1; - if (!$util.isString(message.filename)) - return "filename: string expected"; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.disabled != null && message.hasOwnProperty("disabled")) - if (typeof message.disabled !== "boolean") - return "disabled: boolean expected"; - if (message.substitutions != null && message.hasOwnProperty("substitutions")) { - if (!$util.isObject(message.substitutions)) - return "substitutions: object expected"; - var key = Object.keys(message.substitutions); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.substitutions[key[i]])) - return "substitutions: string{k:string} expected"; - } - if (message.ignoredFiles != null && message.hasOwnProperty("ignoredFiles")) { - if (!Array.isArray(message.ignoredFiles)) - return "ignoredFiles: array expected"; - for (var i = 0; i < message.ignoredFiles.length; ++i) - if (!$util.isString(message.ignoredFiles[i])) - return "ignoredFiles: string[] expected"; - } - if (message.includedFiles != null && message.hasOwnProperty("includedFiles")) { - if (!Array.isArray(message.includedFiles)) - return "includedFiles: array expected"; - for (var i = 0; i < message.includedFiles.length; ++i) - if (!$util.isString(message.includedFiles[i])) - return "includedFiles: string[] expected"; - } - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) - if (!$util.isString(message.serviceAccount)) - return "serviceAccount: string expected"; - if (message.repositoryEventConfig != null && message.hasOwnProperty("repositoryEventConfig")) { - var error = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.verify(message.repositoryEventConfig); - if (error) - return "repositoryEventConfig." + error; + if (message.githubEnterpriseConfig != null && message.hasOwnProperty("githubEnterpriseConfig")) { + properties.enterpriseConfig = 1; + if (!$util.isString(message.githubEnterpriseConfig)) + return "githubEnterpriseConfig: string expected"; } return null; }; /** - * Creates a BuildTrigger message from a plain object. Also converts values to their respective internal types. + * Creates a GitRepoSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger + * @returns {google.devtools.cloudbuild.v1.GitRepoSource} GitRepoSource */ - BuildTrigger.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.BuildTrigger) + GitRepoSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GitRepoSource) return object; - var message = new $root.google.devtools.cloudbuild.v1.BuildTrigger(); - if (object.resourceName != null) - message.resourceName = String(object.resourceName); - if (object.id != null) - message.id = String(object.id); - if (object.description != null) - message.description = String(object.description); - if (object.name != null) - message.name = String(object.name); - if (object.tags) { - if (!Array.isArray(object.tags)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.tags: array expected"); - message.tags = []; - for (var i = 0; i < object.tags.length; ++i) - message.tags[i] = String(object.tags[i]); - } - if (object.triggerTemplate != null) { - if (typeof object.triggerTemplate !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.triggerTemplate: object expected"); - message.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.fromObject(object.triggerTemplate); - } - if (object.github != null) { - if (typeof object.github !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.github: object expected"); - message.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.fromObject(object.github); - } - if (object.pubsubConfig != null) { - if (typeof object.pubsubConfig !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.pubsubConfig: object expected"); - message.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.fromObject(object.pubsubConfig); - } - if (object.webhookConfig != null) { - if (typeof object.webhookConfig !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.webhookConfig: object expected"); - message.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.fromObject(object.webhookConfig); - } - if (object.autodetect != null) - message.autodetect = Boolean(object.autodetect); - if (object.build != null) { - if (typeof object.build !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.build: object expected"); - message.build = $root.google.devtools.cloudbuild.v1.Build.fromObject(object.build); - } - if (object.filename != null) - message.filename = String(object.filename); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.disabled != null) - message.disabled = Boolean(object.disabled); - if (object.substitutions) { - if (typeof object.substitutions !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.substitutions: object expected"); - message.substitutions = {}; - for (var keys = Object.keys(object.substitutions), i = 0; i < keys.length; ++i) - message.substitutions[keys[i]] = String(object.substitutions[keys[i]]); - } - if (object.ignoredFiles) { - if (!Array.isArray(object.ignoredFiles)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.ignoredFiles: array expected"); - message.ignoredFiles = []; - for (var i = 0; i < object.ignoredFiles.length; ++i) - message.ignoredFiles[i] = String(object.ignoredFiles[i]); - } - if (object.includedFiles) { - if (!Array.isArray(object.includedFiles)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.includedFiles: array expected"); - message.includedFiles = []; - for (var i = 0; i < object.includedFiles.length; ++i) - message.includedFiles[i] = String(object.includedFiles[i]); - } - if (object.filter != null) - message.filter = String(object.filter); - if (object.serviceAccount != null) - message.serviceAccount = String(object.serviceAccount); - if (object.repositoryEventConfig != null) { - if (typeof object.repositoryEventConfig !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.repositoryEventConfig: object expected"); - message.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.fromObject(object.repositoryEventConfig); + var message = new $root.google.devtools.cloudbuild.v1.GitRepoSource(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.repository != null) + message.repository = String(object.repository); + if (object.ref != null) + message.ref = String(object.ref); + switch (object.repoType) { + default: + if (typeof object.repoType === "number") { + message.repoType = object.repoType; + break; + } + break; + case "UNKNOWN": + case 0: + message.repoType = 0; + break; + case "CLOUD_SOURCE_REPOSITORIES": + case 1: + message.repoType = 1; + break; + case "GITHUB": + case 2: + message.repoType = 2; + break; + case "BITBUCKET_SERVER": + case 3: + message.repoType = 3; + break; + case "GITLAB": + case 4: + message.repoType = 4; + break; } + if (object.githubEnterpriseConfig != null) + message.githubEnterpriseConfig = String(object.githubEnterpriseConfig); return message; }; /** - * Creates a plain object from a BuildTrigger message. Also converts values to other types if specified. + * Creates a plain object from a GitRepoSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static - * @param {google.devtools.cloudbuild.v1.BuildTrigger} message BuildTrigger + * @param {google.devtools.cloudbuild.v1.GitRepoSource} message GitRepoSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BuildTrigger.toObject = function toObject(message, options) { + GitRepoSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.ignoredFiles = []; - object.includedFiles = []; - object.tags = []; - } - if (options.objects || options.defaults) - object.substitutions = {}; if (options.defaults) { - object.id = ""; - object.createTime = null; - object.triggerTemplate = null; - object.disabled = false; - object.description = ""; - object.github = null; - object.name = ""; - object.pubsubConfig = null; - object.filter = ""; - object.webhookConfig = null; - object.serviceAccount = ""; - object.resourceName = ""; - object.repositoryEventConfig = null; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.build != null && message.hasOwnProperty("build")) { - object.build = $root.google.devtools.cloudbuild.v1.Build.toObject(message.build, options); - if (options.oneofs) - object.buildTemplate = "build"; + object.uri = ""; + object.ref = ""; + object.repoType = options.enums === String ? "UNKNOWN" : 0; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.triggerTemplate != null && message.hasOwnProperty("triggerTemplate")) - object.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.toObject(message.triggerTemplate, options); - if (message.filename != null && message.hasOwnProperty("filename")) { - object.filename = message.filename; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.ref != null && message.hasOwnProperty("ref")) + object.ref = message.ref; + if (message.repoType != null && message.hasOwnProperty("repoType")) + object.repoType = options.enums === String ? $root.google.devtools.cloudbuild.v1.GitFileSource.RepoType[message.repoType] === undefined ? message.repoType : $root.google.devtools.cloudbuild.v1.GitFileSource.RepoType[message.repoType] : message.repoType; + if (message.githubEnterpriseConfig != null && message.hasOwnProperty("githubEnterpriseConfig")) { + object.githubEnterpriseConfig = message.githubEnterpriseConfig; if (options.oneofs) - object.buildTemplate = "filename"; - } - if (message.disabled != null && message.hasOwnProperty("disabled")) - object.disabled = message.disabled; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - var keys2; - if (message.substitutions && (keys2 = Object.keys(message.substitutions)).length) { - object.substitutions = {}; - for (var j = 0; j < keys2.length; ++j) - object.substitutions[keys2[j]] = message.substitutions[keys2[j]]; - } - if (message.github != null && message.hasOwnProperty("github")) - object.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.toObject(message.github, options); - if (message.ignoredFiles && message.ignoredFiles.length) { - object.ignoredFiles = []; - for (var j = 0; j < message.ignoredFiles.length; ++j) - object.ignoredFiles[j] = message.ignoredFiles[j]; - } - if (message.includedFiles && message.includedFiles.length) { - object.includedFiles = []; - for (var j = 0; j < message.includedFiles.length; ++j) - object.includedFiles[j] = message.includedFiles[j]; + object.enterpriseConfig = "githubEnterpriseConfig"; } - if (message.autodetect != null && message.hasOwnProperty("autodetect")) { - object.autodetect = message.autodetect; + if (message.repository != null && message.hasOwnProperty("repository")) { + object.repository = message.repository; if (options.oneofs) - object.buildTemplate = "autodetect"; + object.source = "repository"; } - if (message.tags && message.tags.length) { - object.tags = []; - for (var j = 0; j < message.tags.length; ++j) - object.tags[j] = message.tags[j]; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.pubsubConfig != null && message.hasOwnProperty("pubsubConfig")) - object.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.toObject(message.pubsubConfig, options); - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.webhookConfig != null && message.hasOwnProperty("webhookConfig")) - object.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.toObject(message.webhookConfig, options); - if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) - object.serviceAccount = message.serviceAccount; - if (message.resourceName != null && message.hasOwnProperty("resourceName")) - object.resourceName = message.resourceName; - if (message.repositoryEventConfig != null && message.hasOwnProperty("repositoryEventConfig")) - object.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.toObject(message.repositoryEventConfig, options); return object; }; /** - * Converts this BuildTrigger to JSON. + * Converts this GitRepoSource to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @instance * @returns {Object.} JSON object */ - BuildTrigger.prototype.toJSON = function toJSON() { + GitRepoSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for BuildTrigger + * Gets the default type url for GitRepoSource * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @memberof google.devtools.cloudbuild.v1.GitRepoSource * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - BuildTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GitRepoSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildTrigger"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitRepoSource"; }; - return BuildTrigger; + return GitRepoSource; })(); - v1.RepositoryEventConfig = (function() { + v1.GitFileSource = (function() { /** - * Properties of a RepositoryEventConfig. + * Properties of a GitFileSource. * @memberof google.devtools.cloudbuild.v1 - * @interface IRepositoryEventConfig - * @property {string|null} [repository] RepositoryEventConfig repository - * @property {google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType|null} [repositoryType] RepositoryEventConfig repositoryType - * @property {google.devtools.cloudbuild.v1.IPullRequestFilter|null} [pullRequest] RepositoryEventConfig pullRequest - * @property {google.devtools.cloudbuild.v1.IPushFilter|null} [push] RepositoryEventConfig push + * @interface IGitFileSource + * @property {string|null} [path] GitFileSource path + * @property {string|null} [uri] GitFileSource uri + * @property {string|null} [repository] GitFileSource repository + * @property {google.devtools.cloudbuild.v1.GitFileSource.RepoType|null} [repoType] GitFileSource repoType + * @property {string|null} [revision] GitFileSource revision + * @property {string|null} [githubEnterpriseConfig] GitFileSource githubEnterpriseConfig */ /** - * Constructs a new RepositoryEventConfig. + * Constructs a new GitFileSource. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a RepositoryEventConfig. - * @implements IRepositoryEventConfig + * @classdesc Represents a GitFileSource. + * @implements IGitFileSource * @constructor - * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGitFileSource=} [properties] Properties to set */ - function RepositoryEventConfig(properties) { + function GitFileSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14245,131 +13817,170 @@ } /** - * RepositoryEventConfig repository. - * @member {string} repository - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * GitFileSource path. + * @member {string} path + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance */ - RepositoryEventConfig.prototype.repository = ""; + GitFileSource.prototype.path = ""; /** - * RepositoryEventConfig repositoryType. - * @member {google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType} repositoryType - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * GitFileSource uri. + * @member {string} uri + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance */ - RepositoryEventConfig.prototype.repositoryType = 0; + GitFileSource.prototype.uri = ""; /** - * RepositoryEventConfig pullRequest. - * @member {google.devtools.cloudbuild.v1.IPullRequestFilter|null|undefined} pullRequest - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * GitFileSource repository. + * @member {string|null|undefined} repository + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance */ - RepositoryEventConfig.prototype.pullRequest = null; + GitFileSource.prototype.repository = null; /** - * RepositoryEventConfig push. - * @member {google.devtools.cloudbuild.v1.IPushFilter|null|undefined} push - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * GitFileSource repoType. + * @member {google.devtools.cloudbuild.v1.GitFileSource.RepoType} repoType + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance */ - RepositoryEventConfig.prototype.push = null; + GitFileSource.prototype.repoType = 0; + + /** + * GitFileSource revision. + * @member {string} revision + * @memberof google.devtools.cloudbuild.v1.GitFileSource + * @instance + */ + GitFileSource.prototype.revision = ""; + + /** + * GitFileSource githubEnterpriseConfig. + * @member {string|null|undefined} githubEnterpriseConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource + * @instance + */ + GitFileSource.prototype.githubEnterpriseConfig = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * RepositoryEventConfig filter. - * @member {"pullRequest"|"push"|undefined} filter - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * GitFileSource source. + * @member {"repository"|undefined} source + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance */ - Object.defineProperty(RepositoryEventConfig.prototype, "filter", { - get: $util.oneOfGetter($oneOfFields = ["pullRequest", "push"]), + Object.defineProperty(GitFileSource.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["repository"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new RepositoryEventConfig instance using the specified properties. + * GitFileSource enterpriseConfig. + * @member {"githubEnterpriseConfig"|undefined} enterpriseConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource + * @instance + */ + Object.defineProperty(GitFileSource.prototype, "enterpriseConfig", { + get: $util.oneOfGetter($oneOfFields = ["githubEnterpriseConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GitFileSource instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static - * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig instance + * @param {google.devtools.cloudbuild.v1.IGitFileSource=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GitFileSource} GitFileSource instance */ - RepositoryEventConfig.create = function create(properties) { - return new RepositoryEventConfig(properties); + GitFileSource.create = function create(properties) { + return new GitFileSource(properties); }; /** - * Encodes the specified RepositoryEventConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * Encodes the specified GitFileSource message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitFileSource.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static - * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig} message RepositoryEventConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitFileSource} message GitFileSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RepositoryEventConfig.encode = function encode(message, writer) { + GitFileSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.path); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.repoType != null && Object.hasOwnProperty.call(message, "repoType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repoType); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.revision); + if (message.githubEnterpriseConfig != null && Object.hasOwnProperty.call(message, "githubEnterpriseConfig")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.githubEnterpriseConfig); if (message.repository != null && Object.hasOwnProperty.call(message, "repository")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.repository); - if (message.repositoryType != null && Object.hasOwnProperty.call(message, "repositoryType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.repositoryType); - if (message.pullRequest != null && Object.hasOwnProperty.call(message, "pullRequest")) - $root.google.devtools.cloudbuild.v1.PullRequestFilter.encode(message.pullRequest, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.push != null && Object.hasOwnProperty.call(message, "push")) - $root.google.devtools.cloudbuild.v1.PushFilter.encode(message.push, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + writer.uint32(/* id 7, wireType 2 =*/58).string(message.repository); return writer; }; /** - * Encodes the specified RepositoryEventConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * Encodes the specified GitFileSource message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitFileSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static - * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig} message RepositoryEventConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitFileSource} message GitFileSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RepositoryEventConfig.encodeDelimited = function encodeDelimited(message, writer) { + GitFileSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RepositoryEventConfig message from the specified reader or buffer. + * Decodes a GitFileSource message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig + * @returns {google.devtools.cloudbuild.v1.GitFileSource} GitFileSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RepositoryEventConfig.decode = function decode(reader, length) { + GitFileSource.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.RepositoryEventConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitFileSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.repository = reader.string(); + message.path = reader.string(); break; } case 2: { - message.repositoryType = reader.int32(); + message.uri = reader.string(); + break; + } + case 7: { + message.repository = reader.string(); break; } case 3: { - message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.decode(reader, reader.uint32()); + message.repoType = reader.int32(); break; } case 4: { - message.push = $root.google.devtools.cloudbuild.v1.PushFilter.decode(reader, reader.uint32()); + message.revision = reader.string(); + break; + } + case 5: { + message.githubEnterpriseConfig = reader.string(); break; } default: @@ -14381,221 +13992,251 @@ }; /** - * Decodes a RepositoryEventConfig message from the specified reader or buffer, length delimited. + * Decodes a GitFileSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig + * @returns {google.devtools.cloudbuild.v1.GitFileSource} GitFileSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RepositoryEventConfig.decodeDelimited = function decodeDelimited(reader) { + GitFileSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RepositoryEventConfig message. + * Verifies a GitFileSource message. * @function verify - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RepositoryEventConfig.verify = function verify(message) { + GitFileSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.repository != null && message.hasOwnProperty("repository")) + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.repository != null && message.hasOwnProperty("repository")) { + properties.source = 1; if (!$util.isString(message.repository)) return "repository: string expected"; - if (message.repositoryType != null && message.hasOwnProperty("repositoryType")) - switch (message.repositoryType) { + } + if (message.repoType != null && message.hasOwnProperty("repoType")) + switch (message.repoType) { default: - return "repositoryType: enum value expected"; + return "repoType: enum value expected"; case 0: case 1: case 2: case 3: + case 4: break; } - if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { - properties.filter = 1; - { - var error = $root.google.devtools.cloudbuild.v1.PullRequestFilter.verify(message.pullRequest); - if (error) - return "pullRequest." + error; - } - } - if (message.push != null && message.hasOwnProperty("push")) { - if (properties.filter === 1) - return "filter: multiple values"; - properties.filter = 1; - { - var error = $root.google.devtools.cloudbuild.v1.PushFilter.verify(message.push); - if (error) - return "push." + error; - } + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isString(message.revision)) + return "revision: string expected"; + if (message.githubEnterpriseConfig != null && message.hasOwnProperty("githubEnterpriseConfig")) { + properties.enterpriseConfig = 1; + if (!$util.isString(message.githubEnterpriseConfig)) + return "githubEnterpriseConfig: string expected"; } return null; }; /** - * Creates a RepositoryEventConfig message from a plain object. Also converts values to their respective internal types. + * Creates a GitFileSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig + * @returns {google.devtools.cloudbuild.v1.GitFileSource} GitFileSource */ - RepositoryEventConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.RepositoryEventConfig) + GitFileSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GitFileSource) return object; - var message = new $root.google.devtools.cloudbuild.v1.RepositoryEventConfig(); + var message = new $root.google.devtools.cloudbuild.v1.GitFileSource(); + if (object.path != null) + message.path = String(object.path); + if (object.uri != null) + message.uri = String(object.uri); if (object.repository != null) message.repository = String(object.repository); - switch (object.repositoryType) { + switch (object.repoType) { default: - if (typeof object.repositoryType === "number") { - message.repositoryType = object.repositoryType; + if (typeof object.repoType === "number") { + message.repoType = object.repoType; break; } break; - case "REPOSITORY_TYPE_UNSPECIFIED": + case "UNKNOWN": case 0: - message.repositoryType = 0; + message.repoType = 0; break; - case "GITHUB": + case "CLOUD_SOURCE_REPOSITORIES": case 1: - message.repositoryType = 1; + message.repoType = 1; break; - case "GITHUB_ENTERPRISE": + case "GITHUB": case 2: - message.repositoryType = 2; + message.repoType = 2; break; - case "GITLAB_ENTERPRISE": + case "BITBUCKET_SERVER": case 3: - message.repositoryType = 3; + message.repoType = 3; + break; + case "GITLAB": + case 4: + message.repoType = 4; break; } - if (object.pullRequest != null) { - if (typeof object.pullRequest !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.RepositoryEventConfig.pullRequest: object expected"); - message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.fromObject(object.pullRequest); - } - if (object.push != null) { - if (typeof object.push !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.RepositoryEventConfig.push: object expected"); - message.push = $root.google.devtools.cloudbuild.v1.PushFilter.fromObject(object.push); - } + if (object.revision != null) + message.revision = String(object.revision); + if (object.githubEnterpriseConfig != null) + message.githubEnterpriseConfig = String(object.githubEnterpriseConfig); return message; }; /** - * Creates a plain object from a RepositoryEventConfig message. Also converts values to other types if specified. + * Creates a plain object from a GitFileSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static - * @param {google.devtools.cloudbuild.v1.RepositoryEventConfig} message RepositoryEventConfig + * @param {google.devtools.cloudbuild.v1.GitFileSource} message GitFileSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RepositoryEventConfig.toObject = function toObject(message, options) { + GitFileSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.repository = ""; - object.repositoryType = options.enums === String ? "REPOSITORY_TYPE_UNSPECIFIED" : 0; + object.path = ""; + object.uri = ""; + object.repoType = options.enums === String ? "UNKNOWN" : 0; + object.revision = ""; } - if (message.repository != null && message.hasOwnProperty("repository")) - object.repository = message.repository; - if (message.repositoryType != null && message.hasOwnProperty("repositoryType")) - object.repositoryType = options.enums === String ? $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType[message.repositoryType] === undefined ? message.repositoryType : $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType[message.repositoryType] : message.repositoryType; - if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { - object.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.toObject(message.pullRequest, options); + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.repoType != null && message.hasOwnProperty("repoType")) + object.repoType = options.enums === String ? $root.google.devtools.cloudbuild.v1.GitFileSource.RepoType[message.repoType] === undefined ? message.repoType : $root.google.devtools.cloudbuild.v1.GitFileSource.RepoType[message.repoType] : message.repoType; + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.githubEnterpriseConfig != null && message.hasOwnProperty("githubEnterpriseConfig")) { + object.githubEnterpriseConfig = message.githubEnterpriseConfig; if (options.oneofs) - object.filter = "pullRequest"; + object.enterpriseConfig = "githubEnterpriseConfig"; } - if (message.push != null && message.hasOwnProperty("push")) { - object.push = $root.google.devtools.cloudbuild.v1.PushFilter.toObject(message.push, options); + if (message.repository != null && message.hasOwnProperty("repository")) { + object.repository = message.repository; if (options.oneofs) - object.filter = "push"; + object.source = "repository"; } return object; }; /** - * Converts this RepositoryEventConfig to JSON. + * Converts this GitFileSource to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @instance * @returns {Object.} JSON object */ - RepositoryEventConfig.prototype.toJSON = function toJSON() { + GitFileSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RepositoryEventConfig + * Gets the default type url for GitFileSource * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.GitFileSource * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RepositoryEventConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GitFileSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.RepositoryEventConfig"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitFileSource"; }; /** - * RepositoryType enum. - * @name google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType + * RepoType enum. + * @name google.devtools.cloudbuild.v1.GitFileSource.RepoType * @enum {number} - * @property {number} REPOSITORY_TYPE_UNSPECIFIED=0 REPOSITORY_TYPE_UNSPECIFIED value - * @property {number} GITHUB=1 GITHUB value - * @property {number} GITHUB_ENTERPRISE=2 GITHUB_ENTERPRISE value - * @property {number} GITLAB_ENTERPRISE=3 GITLAB_ENTERPRISE value + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} CLOUD_SOURCE_REPOSITORIES=1 CLOUD_SOURCE_REPOSITORIES value + * @property {number} GITHUB=2 GITHUB value + * @property {number} BITBUCKET_SERVER=3 BITBUCKET_SERVER value + * @property {number} GITLAB=4 GITLAB value */ - RepositoryEventConfig.RepositoryType = (function() { + GitFileSource.RepoType = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "REPOSITORY_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "GITHUB"] = 1; - values[valuesById[2] = "GITHUB_ENTERPRISE"] = 2; - values[valuesById[3] = "GITLAB_ENTERPRISE"] = 3; + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "CLOUD_SOURCE_REPOSITORIES"] = 1; + values[valuesById[2] = "GITHUB"] = 2; + values[valuesById[3] = "BITBUCKET_SERVER"] = 3; + values[valuesById[4] = "GITLAB"] = 4; return values; })(); - return RepositoryEventConfig; + return GitFileSource; })(); - v1.GitHubEventsConfig = (function() { + v1.BuildTrigger = (function() { /** - * Properties of a GitHubEventsConfig. + * Properties of a BuildTrigger. * @memberof google.devtools.cloudbuild.v1 - * @interface IGitHubEventsConfig - * @property {number|Long|null} [installationId] GitHubEventsConfig installationId - * @property {string|null} [owner] GitHubEventsConfig owner - * @property {string|null} [name] GitHubEventsConfig name - * @property {google.devtools.cloudbuild.v1.IPullRequestFilter|null} [pullRequest] GitHubEventsConfig pullRequest - * @property {google.devtools.cloudbuild.v1.IPushFilter|null} [push] GitHubEventsConfig push + * @interface IBuildTrigger + * @property {string|null} [resourceName] BuildTrigger resourceName + * @property {string|null} [id] BuildTrigger id + * @property {string|null} [description] BuildTrigger description + * @property {string|null} [name] BuildTrigger name + * @property {Array.|null} [tags] BuildTrigger tags + * @property {google.devtools.cloudbuild.v1.IRepoSource|null} [triggerTemplate] BuildTrigger triggerTemplate + * @property {google.devtools.cloudbuild.v1.IGitHubEventsConfig|null} [github] BuildTrigger github + * @property {google.devtools.cloudbuild.v1.IPubsubConfig|null} [pubsubConfig] BuildTrigger pubsubConfig + * @property {google.devtools.cloudbuild.v1.IWebhookConfig|null} [webhookConfig] BuildTrigger webhookConfig + * @property {boolean|null} [autodetect] BuildTrigger autodetect + * @property {google.devtools.cloudbuild.v1.IBuild|null} [build] BuildTrigger build + * @property {string|null} [filename] BuildTrigger filename + * @property {google.devtools.cloudbuild.v1.IGitFileSource|null} [gitFileSource] BuildTrigger gitFileSource + * @property {google.protobuf.ITimestamp|null} [createTime] BuildTrigger createTime + * @property {boolean|null} [disabled] BuildTrigger disabled + * @property {Object.|null} [substitutions] BuildTrigger substitutions + * @property {Array.|null} [ignoredFiles] BuildTrigger ignoredFiles + * @property {Array.|null} [includedFiles] BuildTrigger includedFiles + * @property {string|null} [filter] BuildTrigger filter + * @property {google.devtools.cloudbuild.v1.IGitRepoSource|null} [sourceToBuild] BuildTrigger sourceToBuild + * @property {string|null} [serviceAccount] BuildTrigger serviceAccount + * @property {google.devtools.cloudbuild.v1.IRepositoryEventConfig|null} [repositoryEventConfig] BuildTrigger repositoryEventConfig */ /** - * Constructs a new GitHubEventsConfig. + * Constructs a new BuildTrigger. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a GitHubEventsConfig. - * @implements IGitHubEventsConfig + * @classdesc Represents a BuildTrigger. + * @implements IBuildTrigger * @constructor - * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IBuildTrigger=} [properties] Properties to set */ - function GitHubEventsConfig(properties) { + function BuildTrigger(properties) { + this.tags = []; + this.substitutions = {}; + this.ignoredFiles = []; + this.includedFiles = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14603,345 +14244,834 @@ } /** - * GitHubEventsConfig installationId. - * @member {number|Long} installationId - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * BuildTrigger resourceName. + * @member {string} resourceName + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - GitHubEventsConfig.prototype.installationId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + BuildTrigger.prototype.resourceName = ""; /** - * GitHubEventsConfig owner. - * @member {string} owner - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * BuildTrigger id. + * @member {string} id + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - GitHubEventsConfig.prototype.owner = ""; + BuildTrigger.prototype.id = ""; /** - * GitHubEventsConfig name. + * BuildTrigger description. + * @member {string} description + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.description = ""; + + /** + * BuildTrigger name. * @member {string} name - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - GitHubEventsConfig.prototype.name = ""; + BuildTrigger.prototype.name = ""; /** - * GitHubEventsConfig pullRequest. - * @member {google.devtools.cloudbuild.v1.IPullRequestFilter|null|undefined} pullRequest - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * BuildTrigger tags. + * @member {Array.} tags + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - GitHubEventsConfig.prototype.pullRequest = null; + BuildTrigger.prototype.tags = $util.emptyArray; /** - * GitHubEventsConfig push. - * @member {google.devtools.cloudbuild.v1.IPushFilter|null|undefined} push - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * BuildTrigger triggerTemplate. + * @member {google.devtools.cloudbuild.v1.IRepoSource|null|undefined} triggerTemplate + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - GitHubEventsConfig.prototype.push = null; + BuildTrigger.prototype.triggerTemplate = null; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * BuildTrigger github. + * @member {google.devtools.cloudbuild.v1.IGitHubEventsConfig|null|undefined} github + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.github = null; /** - * GitHubEventsConfig event. - * @member {"pullRequest"|"push"|undefined} event - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * BuildTrigger pubsubConfig. + * @member {google.devtools.cloudbuild.v1.IPubsubConfig|null|undefined} pubsubConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance */ - Object.defineProperty(GitHubEventsConfig.prototype, "event", { - get: $util.oneOfGetter($oneOfFields = ["pullRequest", "push"]), - set: $util.oneOfSetter($oneOfFields) - }); + BuildTrigger.prototype.pubsubConfig = null; /** - * Creates a new GitHubEventsConfig instance using the specified properties. - * @function create - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig - * @static - * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig instance + * BuildTrigger webhookConfig. + * @member {google.devtools.cloudbuild.v1.IWebhookConfig|null|undefined} webhookConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance */ - GitHubEventsConfig.create = function create(properties) { - return new GitHubEventsConfig(properties); - }; + BuildTrigger.prototype.webhookConfig = null; /** - * Encodes the specified GitHubEventsConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEventsConfig.verify|verify} messages. - * @function encode - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig - * @static - * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig} message GitHubEventsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * BuildTrigger autodetect. + * @member {boolean|null|undefined} autodetect + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance */ - GitHubEventsConfig.encode = function encode(message, writer) { - if (!writer) + BuildTrigger.prototype.autodetect = null; + + /** + * BuildTrigger build. + * @member {google.devtools.cloudbuild.v1.IBuild|null|undefined} build + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.build = null; + + /** + * BuildTrigger filename. + * @member {string|null|undefined} filename + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.filename = null; + + /** + * BuildTrigger gitFileSource. + * @member {google.devtools.cloudbuild.v1.IGitFileSource|null|undefined} gitFileSource + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.gitFileSource = null; + + /** + * BuildTrigger createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.createTime = null; + + /** + * BuildTrigger disabled. + * @member {boolean} disabled + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.disabled = false; + + /** + * BuildTrigger substitutions. + * @member {Object.} substitutions + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.substitutions = $util.emptyObject; + + /** + * BuildTrigger ignoredFiles. + * @member {Array.} ignoredFiles + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.ignoredFiles = $util.emptyArray; + + /** + * BuildTrigger includedFiles. + * @member {Array.} includedFiles + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.includedFiles = $util.emptyArray; + + /** + * BuildTrigger filter. + * @member {string} filter + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.filter = ""; + + /** + * BuildTrigger sourceToBuild. + * @member {google.devtools.cloudbuild.v1.IGitRepoSource|null|undefined} sourceToBuild + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.sourceToBuild = null; + + /** + * BuildTrigger serviceAccount. + * @member {string} serviceAccount + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.serviceAccount = ""; + + /** + * BuildTrigger repositoryEventConfig. + * @member {google.devtools.cloudbuild.v1.IRepositoryEventConfig|null|undefined} repositoryEventConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + BuildTrigger.prototype.repositoryEventConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BuildTrigger buildTemplate. + * @member {"autodetect"|"build"|"filename"|"gitFileSource"|undefined} buildTemplate + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @instance + */ + Object.defineProperty(BuildTrigger.prototype, "buildTemplate", { + get: $util.oneOfGetter($oneOfFields = ["autodetect", "build", "filename", "gitFileSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BuildTrigger instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @static + * @param {google.devtools.cloudbuild.v1.IBuildTrigger=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger instance + */ + BuildTrigger.create = function create(properties) { + return new BuildTrigger(properties); + }; + + /** + * Encodes the specified BuildTrigger message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildTrigger.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @static + * @param {google.devtools.cloudbuild.v1.IBuildTrigger} message BuildTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildTrigger.encode = function encode(message, writer) { + if (!writer) writer = $Writer.create(); - if (message.installationId != null && Object.hasOwnProperty.call(message, "installationId")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.installationId); - if (message.pullRequest != null && Object.hasOwnProperty.call(message, "pullRequest")) - $root.google.devtools.cloudbuild.v1.PullRequestFilter.encode(message.pullRequest, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.push != null && Object.hasOwnProperty.call(message, "push")) - $root.google.devtools.cloudbuild.v1.PushFilter.encode(message.push, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.owner != null && Object.hasOwnProperty.call(message, "owner")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.owner); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.build != null && Object.hasOwnProperty.call(message, "build")) + $root.google.devtools.cloudbuild.v1.Build.encode(message.build, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.triggerTemplate != null && Object.hasOwnProperty.call(message, "triggerTemplate")) + $root.google.devtools.cloudbuild.v1.RepoSource.encode(message.triggerTemplate, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.filename != null && Object.hasOwnProperty.call(message, "filename")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.filename); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.disabled); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.description); + if (message.substitutions != null && Object.hasOwnProperty.call(message, "substitutions")) + for (var keys = Object.keys(message.substitutions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.substitutions[keys[i]]).ldelim(); + if (message.github != null && Object.hasOwnProperty.call(message, "github")) + $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.encode(message.github, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.ignoredFiles != null && message.ignoredFiles.length) + for (var i = 0; i < message.ignoredFiles.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ignoredFiles[i]); + if (message.includedFiles != null && message.includedFiles.length) + for (var i = 0; i < message.includedFiles.length; ++i) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.includedFiles[i]); + if (message.autodetect != null && Object.hasOwnProperty.call(message, "autodetect")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.autodetect); + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.tags[i]); if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); + writer.uint32(/* id 21, wireType 2 =*/170).string(message.name); + if (message.gitFileSource != null && Object.hasOwnProperty.call(message, "gitFileSource")) + $root.google.devtools.cloudbuild.v1.GitFileSource.encode(message.gitFileSource, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.sourceToBuild != null && Object.hasOwnProperty.call(message, "sourceToBuild")) + $root.google.devtools.cloudbuild.v1.GitRepoSource.encode(message.sourceToBuild, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.pubsubConfig != null && Object.hasOwnProperty.call(message, "pubsubConfig")) + $root.google.devtools.cloudbuild.v1.PubsubConfig.encode(message.pubsubConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 30, wireType 2 =*/242).string(message.filter); + if (message.webhookConfig != null && Object.hasOwnProperty.call(message, "webhookConfig")) + $root.google.devtools.cloudbuild.v1.WebhookConfig.encode(message.webhookConfig, writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) + writer.uint32(/* id 33, wireType 2 =*/266).string(message.serviceAccount); + if (message.resourceName != null && Object.hasOwnProperty.call(message, "resourceName")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.resourceName); + if (message.repositoryEventConfig != null && Object.hasOwnProperty.call(message, "repositoryEventConfig")) + $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.encode(message.repositoryEventConfig, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); return writer; }; /** - * Encodes the specified GitHubEventsConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEventsConfig.verify|verify} messages. + * Encodes the specified BuildTrigger message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildTrigger.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static - * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig} message GitHubEventsConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IBuildTrigger} message BuildTrigger message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GitHubEventsConfig.encodeDelimited = function encodeDelimited(message, writer) { + BuildTrigger.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GitHubEventsConfig message from the specified reader or buffer. + * Decodes a BuildTrigger message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig + * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GitHubEventsConfig.decode = function decode(reader, length) { + BuildTrigger.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitHubEventsConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildTrigger(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 34: { + message.resourceName = reader.string(); + break; + } case 1: { - message.installationId = reader.int64(); + message.id = reader.string(); break; } - case 6: { - message.owner = reader.string(); + case 10: { + message.description = reader.string(); break; } - case 7: { + case 21: { message.name = reader.string(); break; } + case 19: { + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + } + case 7: { + message.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.decode(reader, reader.uint32()); + break; + } + case 13: { + message.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.decode(reader, reader.uint32()); + break; + } + case 29: { + message.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.decode(reader, reader.uint32()); + break; + } + case 31: { + message.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.decode(reader, reader.uint32()); + break; + } + case 18: { + message.autodetect = reader.bool(); + break; + } case 4: { - message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.decode(reader, reader.uint32()); + message.build = $root.google.devtools.cloudbuild.v1.Build.decode(reader, reader.uint32()); + break; + } + case 8: { + message.filename = reader.string(); + break; + } + case 24: { + message.gitFileSource = $root.google.devtools.cloudbuild.v1.GitFileSource.decode(reader, reader.uint32()); break; } case 5: { - message.push = $root.google.devtools.cloudbuild.v1.PushFilter.decode(reader, reader.uint32()); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GitHubEventsConfig message from the specified reader or buffer, length delimited. + case 9: { + message.disabled = reader.bool(); + break; + } + case 11: { + if (message.substitutions === $util.emptyObject) + message.substitutions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.substitutions[key] = value; + break; + } + case 15: { + if (!(message.ignoredFiles && message.ignoredFiles.length)) + message.ignoredFiles = []; + message.ignoredFiles.push(reader.string()); + break; + } + case 16: { + if (!(message.includedFiles && message.includedFiles.length)) + message.includedFiles = []; + message.includedFiles.push(reader.string()); + break; + } + case 30: { + message.filter = reader.string(); + break; + } + case 26: { + message.sourceToBuild = $root.google.devtools.cloudbuild.v1.GitRepoSource.decode(reader, reader.uint32()); + break; + } + case 33: { + message.serviceAccount = reader.string(); + break; + } + case 39: { + message.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildTrigger message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig + * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GitHubEventsConfig.decodeDelimited = function decodeDelimited(reader) { + BuildTrigger.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GitHubEventsConfig message. + * Verifies a BuildTrigger message. * @function verify - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GitHubEventsConfig.verify = function verify(message) { + BuildTrigger.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.installationId != null && message.hasOwnProperty("installationId")) - if (!$util.isInteger(message.installationId) && !(message.installationId && $util.isInteger(message.installationId.low) && $util.isInteger(message.installationId.high))) - return "installationId: integer|Long expected"; - if (message.owner != null && message.hasOwnProperty("owner")) - if (!$util.isString(message.owner)) - return "owner: string expected"; + if (message.resourceName != null && message.hasOwnProperty("resourceName")) + if (!$util.isString(message.resourceName)) + return "resourceName: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { - properties.event = 1; + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.triggerTemplate != null && message.hasOwnProperty("triggerTemplate")) { + var error = $root.google.devtools.cloudbuild.v1.RepoSource.verify(message.triggerTemplate); + if (error) + return "triggerTemplate." + error; + } + if (message.github != null && message.hasOwnProperty("github")) { + var error = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.verify(message.github); + if (error) + return "github." + error; + } + if (message.pubsubConfig != null && message.hasOwnProperty("pubsubConfig")) { + var error = $root.google.devtools.cloudbuild.v1.PubsubConfig.verify(message.pubsubConfig); + if (error) + return "pubsubConfig." + error; + } + if (message.webhookConfig != null && message.hasOwnProperty("webhookConfig")) { + var error = $root.google.devtools.cloudbuild.v1.WebhookConfig.verify(message.webhookConfig); + if (error) + return "webhookConfig." + error; + } + if (message.autodetect != null && message.hasOwnProperty("autodetect")) { + properties.buildTemplate = 1; + if (typeof message.autodetect !== "boolean") + return "autodetect: boolean expected"; + } + if (message.build != null && message.hasOwnProperty("build")) { + if (properties.buildTemplate === 1) + return "buildTemplate: multiple values"; + properties.buildTemplate = 1; { - var error = $root.google.devtools.cloudbuild.v1.PullRequestFilter.verify(message.pullRequest); + var error = $root.google.devtools.cloudbuild.v1.Build.verify(message.build); if (error) - return "pullRequest." + error; + return "build." + error; } } - if (message.push != null && message.hasOwnProperty("push")) { - if (properties.event === 1) - return "event: multiple values"; - properties.event = 1; + if (message.filename != null && message.hasOwnProperty("filename")) { + if (properties.buildTemplate === 1) + return "buildTemplate: multiple values"; + properties.buildTemplate = 1; + if (!$util.isString(message.filename)) + return "filename: string expected"; + } + if (message.gitFileSource != null && message.hasOwnProperty("gitFileSource")) { + if (properties.buildTemplate === 1) + return "buildTemplate: multiple values"; + properties.buildTemplate = 1; { - var error = $root.google.devtools.cloudbuild.v1.PushFilter.verify(message.push); + var error = $root.google.devtools.cloudbuild.v1.GitFileSource.verify(message.gitFileSource); if (error) - return "push." + error; + return "gitFileSource." + error; } } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.substitutions != null && message.hasOwnProperty("substitutions")) { + if (!$util.isObject(message.substitutions)) + return "substitutions: object expected"; + var key = Object.keys(message.substitutions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.substitutions[key[i]])) + return "substitutions: string{k:string} expected"; + } + if (message.ignoredFiles != null && message.hasOwnProperty("ignoredFiles")) { + if (!Array.isArray(message.ignoredFiles)) + return "ignoredFiles: array expected"; + for (var i = 0; i < message.ignoredFiles.length; ++i) + if (!$util.isString(message.ignoredFiles[i])) + return "ignoredFiles: string[] expected"; + } + if (message.includedFiles != null && message.hasOwnProperty("includedFiles")) { + if (!Array.isArray(message.includedFiles)) + return "includedFiles: array expected"; + for (var i = 0; i < message.includedFiles.length; ++i) + if (!$util.isString(message.includedFiles[i])) + return "includedFiles: string[] expected"; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.sourceToBuild != null && message.hasOwnProperty("sourceToBuild")) { + var error = $root.google.devtools.cloudbuild.v1.GitRepoSource.verify(message.sourceToBuild); + if (error) + return "sourceToBuild." + error; + } + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + if (!$util.isString(message.serviceAccount)) + return "serviceAccount: string expected"; + if (message.repositoryEventConfig != null && message.hasOwnProperty("repositoryEventConfig")) { + var error = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.verify(message.repositoryEventConfig); + if (error) + return "repositoryEventConfig." + error; + } return null; }; /** - * Creates a GitHubEventsConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BuildTrigger message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig + * @returns {google.devtools.cloudbuild.v1.BuildTrigger} BuildTrigger */ - GitHubEventsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.GitHubEventsConfig) + BuildTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.BuildTrigger) return object; - var message = new $root.google.devtools.cloudbuild.v1.GitHubEventsConfig(); - if (object.installationId != null) - if ($util.Long) - (message.installationId = $util.Long.fromValue(object.installationId)).unsigned = false; - else if (typeof object.installationId === "string") - message.installationId = parseInt(object.installationId, 10); - else if (typeof object.installationId === "number") - message.installationId = object.installationId; - else if (typeof object.installationId === "object") - message.installationId = new $util.LongBits(object.installationId.low >>> 0, object.installationId.high >>> 0).toNumber(); - if (object.owner != null) - message.owner = String(object.owner); + var message = new $root.google.devtools.cloudbuild.v1.BuildTrigger(); + if (object.resourceName != null) + message.resourceName = String(object.resourceName); + if (object.id != null) + message.id = String(object.id); + if (object.description != null) + message.description = String(object.description); if (object.name != null) message.name = String(object.name); - if (object.pullRequest != null) { - if (typeof object.pullRequest !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.GitHubEventsConfig.pullRequest: object expected"); - message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.fromObject(object.pullRequest); + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); } - if (object.push != null) { - if (typeof object.push !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.GitHubEventsConfig.push: object expected"); - message.push = $root.google.devtools.cloudbuild.v1.PushFilter.fromObject(object.push); + if (object.triggerTemplate != null) { + if (typeof object.triggerTemplate !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.triggerTemplate: object expected"); + message.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.fromObject(object.triggerTemplate); } - return message; - }; - - /** - * Creates a plain object from a GitHubEventsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig - * @static - * @param {google.devtools.cloudbuild.v1.GitHubEventsConfig} message GitHubEventsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GitHubEventsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.installationId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.installationId = options.longs === String ? "0" : 0; - object.owner = ""; + if (object.github != null) { + if (typeof object.github !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.github: object expected"); + message.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.fromObject(object.github); + } + if (object.pubsubConfig != null) { + if (typeof object.pubsubConfig !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.pubsubConfig: object expected"); + message.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.fromObject(object.pubsubConfig); + } + if (object.webhookConfig != null) { + if (typeof object.webhookConfig !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.webhookConfig: object expected"); + message.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.fromObject(object.webhookConfig); + } + if (object.autodetect != null) + message.autodetect = Boolean(object.autodetect); + if (object.build != null) { + if (typeof object.build !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.build: object expected"); + message.build = $root.google.devtools.cloudbuild.v1.Build.fromObject(object.build); + } + if (object.filename != null) + message.filename = String(object.filename); + if (object.gitFileSource != null) { + if (typeof object.gitFileSource !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.gitFileSource: object expected"); + message.gitFileSource = $root.google.devtools.cloudbuild.v1.GitFileSource.fromObject(object.gitFileSource); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.substitutions) { + if (typeof object.substitutions !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.substitutions: object expected"); + message.substitutions = {}; + for (var keys = Object.keys(object.substitutions), i = 0; i < keys.length; ++i) + message.substitutions[keys[i]] = String(object.substitutions[keys[i]]); + } + if (object.ignoredFiles) { + if (!Array.isArray(object.ignoredFiles)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.ignoredFiles: array expected"); + message.ignoredFiles = []; + for (var i = 0; i < object.ignoredFiles.length; ++i) + message.ignoredFiles[i] = String(object.ignoredFiles[i]); + } + if (object.includedFiles) { + if (!Array.isArray(object.includedFiles)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.includedFiles: array expected"); + message.includedFiles = []; + for (var i = 0; i < object.includedFiles.length; ++i) + message.includedFiles[i] = String(object.includedFiles[i]); + } + if (object.filter != null) + message.filter = String(object.filter); + if (object.sourceToBuild != null) { + if (typeof object.sourceToBuild !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.sourceToBuild: object expected"); + message.sourceToBuild = $root.google.devtools.cloudbuild.v1.GitRepoSource.fromObject(object.sourceToBuild); + } + if (object.serviceAccount != null) + message.serviceAccount = String(object.serviceAccount); + if (object.repositoryEventConfig != null) { + if (typeof object.repositoryEventConfig !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildTrigger.repositoryEventConfig: object expected"); + message.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.fromObject(object.repositoryEventConfig); + } + return message; + }; + + /** + * Creates a plain object from a BuildTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.BuildTrigger + * @static + * @param {google.devtools.cloudbuild.v1.BuildTrigger} message BuildTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ignoredFiles = []; + object.includedFiles = []; + object.tags = []; + } + if (options.objects || options.defaults) + object.substitutions = {}; + if (options.defaults) { + object.id = ""; + object.createTime = null; + object.triggerTemplate = null; + object.disabled = false; + object.description = ""; + object.github = null; object.name = ""; + object.sourceToBuild = null; + object.pubsubConfig = null; + object.filter = ""; + object.webhookConfig = null; + object.serviceAccount = ""; + object.resourceName = ""; + object.repositoryEventConfig = null; } - if (message.installationId != null && message.hasOwnProperty("installationId")) - if (typeof message.installationId === "number") - object.installationId = options.longs === String ? String(message.installationId) : message.installationId; - else - object.installationId = options.longs === String ? $util.Long.prototype.toString.call(message.installationId) : options.longs === Number ? new $util.LongBits(message.installationId.low >>> 0, message.installationId.high >>> 0).toNumber() : message.installationId; - if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { - object.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.toObject(message.pullRequest, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.build != null && message.hasOwnProperty("build")) { + object.build = $root.google.devtools.cloudbuild.v1.Build.toObject(message.build, options); if (options.oneofs) - object.event = "pullRequest"; + object.buildTemplate = "build"; } - if (message.push != null && message.hasOwnProperty("push")) { - object.push = $root.google.devtools.cloudbuild.v1.PushFilter.toObject(message.push, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.triggerTemplate != null && message.hasOwnProperty("triggerTemplate")) + object.triggerTemplate = $root.google.devtools.cloudbuild.v1.RepoSource.toObject(message.triggerTemplate, options); + if (message.filename != null && message.hasOwnProperty("filename")) { + object.filename = message.filename; if (options.oneofs) - object.event = "push"; + object.buildTemplate = "filename"; + } + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + var keys2; + if (message.substitutions && (keys2 = Object.keys(message.substitutions)).length) { + object.substitutions = {}; + for (var j = 0; j < keys2.length; ++j) + object.substitutions[keys2[j]] = message.substitutions[keys2[j]]; + } + if (message.github != null && message.hasOwnProperty("github")) + object.github = $root.google.devtools.cloudbuild.v1.GitHubEventsConfig.toObject(message.github, options); + if (message.ignoredFiles && message.ignoredFiles.length) { + object.ignoredFiles = []; + for (var j = 0; j < message.ignoredFiles.length; ++j) + object.ignoredFiles[j] = message.ignoredFiles[j]; + } + if (message.includedFiles && message.includedFiles.length) { + object.includedFiles = []; + for (var j = 0; j < message.includedFiles.length; ++j) + object.includedFiles[j] = message.includedFiles[j]; + } + if (message.autodetect != null && message.hasOwnProperty("autodetect")) { + object.autodetect = message.autodetect; + if (options.oneofs) + object.buildTemplate = "autodetect"; + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; } - if (message.owner != null && message.hasOwnProperty("owner")) - object.owner = message.owner; if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.gitFileSource != null && message.hasOwnProperty("gitFileSource")) { + object.gitFileSource = $root.google.devtools.cloudbuild.v1.GitFileSource.toObject(message.gitFileSource, options); + if (options.oneofs) + object.buildTemplate = "gitFileSource"; + } + if (message.sourceToBuild != null && message.hasOwnProperty("sourceToBuild")) + object.sourceToBuild = $root.google.devtools.cloudbuild.v1.GitRepoSource.toObject(message.sourceToBuild, options); + if (message.pubsubConfig != null && message.hasOwnProperty("pubsubConfig")) + object.pubsubConfig = $root.google.devtools.cloudbuild.v1.PubsubConfig.toObject(message.pubsubConfig, options); + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.webhookConfig != null && message.hasOwnProperty("webhookConfig")) + object.webhookConfig = $root.google.devtools.cloudbuild.v1.WebhookConfig.toObject(message.webhookConfig, options); + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + object.serviceAccount = message.serviceAccount; + if (message.resourceName != null && message.hasOwnProperty("resourceName")) + object.resourceName = message.resourceName; + if (message.repositoryEventConfig != null && message.hasOwnProperty("repositoryEventConfig")) + object.repositoryEventConfig = $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.toObject(message.repositoryEventConfig, options); return object; }; /** - * Converts this GitHubEventsConfig to JSON. + * Converts this BuildTrigger to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @instance * @returns {Object.} JSON object */ - GitHubEventsConfig.prototype.toJSON = function toJSON() { + BuildTrigger.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GitHubEventsConfig + * Gets the default type url for BuildTrigger * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @memberof google.devtools.cloudbuild.v1.BuildTrigger * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GitHubEventsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + BuildTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitHubEventsConfig"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildTrigger"; }; - return GitHubEventsConfig; + return BuildTrigger; })(); - v1.PubsubConfig = (function() { + v1.RepositoryEventConfig = (function() { /** - * Properties of a PubsubConfig. + * Properties of a RepositoryEventConfig. * @memberof google.devtools.cloudbuild.v1 - * @interface IPubsubConfig - * @property {string|null} [subscription] PubsubConfig subscription - * @property {string|null} [topic] PubsubConfig topic - * @property {string|null} [serviceAccountEmail] PubsubConfig serviceAccountEmail - * @property {google.devtools.cloudbuild.v1.PubsubConfig.State|null} [state] PubsubConfig state + * @interface IRepositoryEventConfig + * @property {string|null} [repository] RepositoryEventConfig repository + * @property {google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType|null} [repositoryType] RepositoryEventConfig repositoryType + * @property {google.devtools.cloudbuild.v1.IPullRequestFilter|null} [pullRequest] RepositoryEventConfig pullRequest + * @property {google.devtools.cloudbuild.v1.IPushFilter|null} [push] RepositoryEventConfig push */ /** - * Constructs a new PubsubConfig. + * Constructs a new RepositoryEventConfig. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a PubsubConfig. - * @implements IPubsubConfig + * @classdesc Represents a RepositoryEventConfig. + * @implements IRepositoryEventConfig * @constructor - * @param {google.devtools.cloudbuild.v1.IPubsubConfig=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig=} [properties] Properties to set */ - function PubsubConfig(properties) { + function RepositoryEventConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14949,117 +15079,131 @@ } /** - * PubsubConfig subscription. - * @member {string} subscription - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * RepositoryEventConfig repository. + * @member {string} repository + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @instance */ - PubsubConfig.prototype.subscription = ""; + RepositoryEventConfig.prototype.repository = ""; /** - * PubsubConfig topic. - * @member {string} topic - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * RepositoryEventConfig repositoryType. + * @member {google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType} repositoryType + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @instance */ - PubsubConfig.prototype.topic = ""; + RepositoryEventConfig.prototype.repositoryType = 0; /** - * PubsubConfig serviceAccountEmail. - * @member {string} serviceAccountEmail - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * RepositoryEventConfig pullRequest. + * @member {google.devtools.cloudbuild.v1.IPullRequestFilter|null|undefined} pullRequest + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @instance */ - PubsubConfig.prototype.serviceAccountEmail = ""; + RepositoryEventConfig.prototype.pullRequest = null; /** - * PubsubConfig state. - * @member {google.devtools.cloudbuild.v1.PubsubConfig.State} state - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * RepositoryEventConfig push. + * @member {google.devtools.cloudbuild.v1.IPushFilter|null|undefined} push + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @instance */ - PubsubConfig.prototype.state = 0; + RepositoryEventConfig.prototype.push = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new PubsubConfig instance using the specified properties. - * @function create - * @memberof google.devtools.cloudbuild.v1.PubsubConfig - * @static - * @param {google.devtools.cloudbuild.v1.IPubsubConfig=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig instance + * RepositoryEventConfig filter. + * @member {"pullRequest"|"push"|undefined} filter + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance */ - PubsubConfig.create = function create(properties) { - return new PubsubConfig(properties); + Object.defineProperty(RepositoryEventConfig.prototype, "filter", { + get: $util.oneOfGetter($oneOfFields = ["pullRequest", "push"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RepositoryEventConfig instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig instance + */ + RepositoryEventConfig.create = function create(properties) { + return new RepositoryEventConfig(properties); }; /** - * Encodes the specified PubsubConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.PubsubConfig.verify|verify} messages. + * Encodes the specified RepositoryEventConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static - * @param {google.devtools.cloudbuild.v1.IPubsubConfig} message PubsubConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig} message RepositoryEventConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PubsubConfig.encode = function encode(message, writer) { + RepositoryEventConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); - if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.topic); - if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceAccountEmail); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.repository != null && Object.hasOwnProperty.call(message, "repository")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.repository); + if (message.repositoryType != null && Object.hasOwnProperty.call(message, "repositoryType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.repositoryType); + if (message.pullRequest != null && Object.hasOwnProperty.call(message, "pullRequest")) + $root.google.devtools.cloudbuild.v1.PullRequestFilter.encode(message.pullRequest, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.push != null && Object.hasOwnProperty.call(message, "push")) + $root.google.devtools.cloudbuild.v1.PushFilter.encode(message.push, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified PubsubConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PubsubConfig.verify|verify} messages. + * Encodes the specified RepositoryEventConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static - * @param {google.devtools.cloudbuild.v1.IPubsubConfig} message PubsubConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig} message RepositoryEventConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PubsubConfig.encodeDelimited = function encodeDelimited(message, writer) { + RepositoryEventConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PubsubConfig message from the specified reader or buffer. + * Decodes a RepositoryEventConfig message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig + * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PubsubConfig.decode = function decode(reader, length) { + RepositoryEventConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PubsubConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.RepositoryEventConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.subscription = reader.string(); + message.repository = reader.string(); break; } case 2: { - message.topic = reader.string(); + message.repositoryType = reader.int32(); break; } case 3: { - message.serviceAccountEmail = reader.string(); + message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.decode(reader, reader.uint32()); break; } case 4: { - message.state = reader.int32(); + message.push = $root.google.devtools.cloudbuild.v1.PushFilter.decode(reader, reader.uint32()); break; } default: @@ -15071,202 +15215,221 @@ }; /** - * Decodes a PubsubConfig message from the specified reader or buffer, length delimited. + * Decodes a RepositoryEventConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig + * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PubsubConfig.decodeDelimited = function decodeDelimited(reader) { + RepositoryEventConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PubsubConfig message. + * Verifies a RepositoryEventConfig message. * @function verify - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PubsubConfig.verify = function verify(message) { + RepositoryEventConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.subscription != null && message.hasOwnProperty("subscription")) - if (!$util.isString(message.subscription)) - return "subscription: string expected"; - if (message.topic != null && message.hasOwnProperty("topic")) - if (!$util.isString(message.topic)) - return "topic: string expected"; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) - if (!$util.isString(message.serviceAccountEmail)) - return "serviceAccountEmail: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { + var properties = {}; + if (message.repository != null && message.hasOwnProperty("repository")) + if (!$util.isString(message.repository)) + return "repository: string expected"; + if (message.repositoryType != null && message.hasOwnProperty("repositoryType")) + switch (message.repositoryType) { default: - return "state: enum value expected"; + return "repositoryType: enum value expected"; case 0: case 1: case 2: case 3: - case 4: break; } + if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { + properties.filter = 1; + { + var error = $root.google.devtools.cloudbuild.v1.PullRequestFilter.verify(message.pullRequest); + if (error) + return "pullRequest." + error; + } + } + if (message.push != null && message.hasOwnProperty("push")) { + if (properties.filter === 1) + return "filter: multiple values"; + properties.filter = 1; + { + var error = $root.google.devtools.cloudbuild.v1.PushFilter.verify(message.push); + if (error) + return "push." + error; + } + } return null; }; /** - * Creates a PubsubConfig message from a plain object. Also converts values to their respective internal types. + * Creates a RepositoryEventConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig + * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig */ - PubsubConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.PubsubConfig) + RepositoryEventConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.RepositoryEventConfig) return object; - var message = new $root.google.devtools.cloudbuild.v1.PubsubConfig(); - if (object.subscription != null) - message.subscription = String(object.subscription); - if (object.topic != null) - message.topic = String(object.topic); - if (object.serviceAccountEmail != null) - message.serviceAccountEmail = String(object.serviceAccountEmail); - switch (object.state) { + var message = new $root.google.devtools.cloudbuild.v1.RepositoryEventConfig(); + if (object.repository != null) + message.repository = String(object.repository); + switch (object.repositoryType) { default: - if (typeof object.state === "number") { - message.state = object.state; + if (typeof object.repositoryType === "number") { + message.repositoryType = object.repositoryType; break; } break; - case "STATE_UNSPECIFIED": + case "REPOSITORY_TYPE_UNSPECIFIED": case 0: - message.state = 0; + message.repositoryType = 0; break; - case "OK": + case "GITHUB": case 1: - message.state = 1; + message.repositoryType = 1; break; - case "SUBSCRIPTION_DELETED": + case "GITHUB_ENTERPRISE": case 2: - message.state = 2; + message.repositoryType = 2; break; - case "TOPIC_DELETED": + case "GITLAB_ENTERPRISE": case 3: - message.state = 3; - break; - case "SUBSCRIPTION_MISCONFIGURED": - case 4: - message.state = 4; + message.repositoryType = 3; break; } + if (object.pullRequest != null) { + if (typeof object.pullRequest !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.RepositoryEventConfig.pullRequest: object expected"); + message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.fromObject(object.pullRequest); + } + if (object.push != null) { + if (typeof object.push !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.RepositoryEventConfig.push: object expected"); + message.push = $root.google.devtools.cloudbuild.v1.PushFilter.fromObject(object.push); + } return message; }; /** - * Creates a plain object from a PubsubConfig message. Also converts values to other types if specified. + * Creates a plain object from a RepositoryEventConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static - * @param {google.devtools.cloudbuild.v1.PubsubConfig} message PubsubConfig + * @param {google.devtools.cloudbuild.v1.RepositoryEventConfig} message RepositoryEventConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PubsubConfig.toObject = function toObject(message, options) { + RepositoryEventConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.subscription = ""; - object.topic = ""; - object.serviceAccountEmail = ""; - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.repository = ""; + object.repositoryType = options.enums === String ? "REPOSITORY_TYPE_UNSPECIFIED" : 0; + } + if (message.repository != null && message.hasOwnProperty("repository")) + object.repository = message.repository; + if (message.repositoryType != null && message.hasOwnProperty("repositoryType")) + object.repositoryType = options.enums === String ? $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType[message.repositoryType] === undefined ? message.repositoryType : $root.google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType[message.repositoryType] : message.repositoryType; + if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { + object.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.toObject(message.pullRequest, options); + if (options.oneofs) + object.filter = "pullRequest"; + } + if (message.push != null && message.hasOwnProperty("push")) { + object.push = $root.google.devtools.cloudbuild.v1.PushFilter.toObject(message.push, options); + if (options.oneofs) + object.filter = "push"; } - if (message.subscription != null && message.hasOwnProperty("subscription")) - object.subscription = message.subscription; - if (message.topic != null && message.hasOwnProperty("topic")) - object.topic = message.topic; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) - object.serviceAccountEmail = message.serviceAccountEmail; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.devtools.cloudbuild.v1.PubsubConfig.State[message.state] === undefined ? message.state : $root.google.devtools.cloudbuild.v1.PubsubConfig.State[message.state] : message.state; return object; }; /** - * Converts this PubsubConfig to JSON. + * Converts this RepositoryEventConfig to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @instance * @returns {Object.} JSON object */ - PubsubConfig.prototype.toJSON = function toJSON() { + RepositoryEventConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PubsubConfig + * Gets the default type url for RepositoryEventConfig * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.PubsubConfig + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PubsubConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + RepositoryEventConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PubsubConfig"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.RepositoryEventConfig"; }; /** - * State enum. - * @name google.devtools.cloudbuild.v1.PubsubConfig.State + * RepositoryType enum. + * @name google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} OK=1 OK value - * @property {number} SUBSCRIPTION_DELETED=2 SUBSCRIPTION_DELETED value - * @property {number} TOPIC_DELETED=3 TOPIC_DELETED value - * @property {number} SUBSCRIPTION_MISCONFIGURED=4 SUBSCRIPTION_MISCONFIGURED value + * @property {number} REPOSITORY_TYPE_UNSPECIFIED=0 REPOSITORY_TYPE_UNSPECIFIED value + * @property {number} GITHUB=1 GITHUB value + * @property {number} GITHUB_ENTERPRISE=2 GITHUB_ENTERPRISE value + * @property {number} GITLAB_ENTERPRISE=3 GITLAB_ENTERPRISE value */ - PubsubConfig.State = (function() { + RepositoryEventConfig.RepositoryType = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "OK"] = 1; - values[valuesById[2] = "SUBSCRIPTION_DELETED"] = 2; - values[valuesById[3] = "TOPIC_DELETED"] = 3; - values[valuesById[4] = "SUBSCRIPTION_MISCONFIGURED"] = 4; + values[valuesById[0] = "REPOSITORY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GITHUB"] = 1; + values[valuesById[2] = "GITHUB_ENTERPRISE"] = 2; + values[valuesById[3] = "GITLAB_ENTERPRISE"] = 3; return values; })(); - return PubsubConfig; + return RepositoryEventConfig; })(); - v1.WebhookConfig = (function() { + v1.GitHubEventsConfig = (function() { /** - * Properties of a WebhookConfig. + * Properties of a GitHubEventsConfig. * @memberof google.devtools.cloudbuild.v1 - * @interface IWebhookConfig - * @property {string|null} [secret] WebhookConfig secret - * @property {google.devtools.cloudbuild.v1.WebhookConfig.State|null} [state] WebhookConfig state + * @interface IGitHubEventsConfig + * @property {number|Long|null} [installationId] GitHubEventsConfig installationId + * @property {string|null} [owner] GitHubEventsConfig owner + * @property {string|null} [name] GitHubEventsConfig name + * @property {google.devtools.cloudbuild.v1.IPullRequestFilter|null} [pullRequest] GitHubEventsConfig pullRequest + * @property {google.devtools.cloudbuild.v1.IPushFilter|null} [push] GitHubEventsConfig push */ /** - * Constructs a new WebhookConfig. + * Constructs a new GitHubEventsConfig. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a WebhookConfig. - * @implements IWebhookConfig + * @classdesc Represents a GitHubEventsConfig. + * @implements IGitHubEventsConfig * @constructor - * @param {google.devtools.cloudbuild.v1.IWebhookConfig=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig=} [properties] Properties to set */ - function WebhookConfig(properties) { + function GitHubEventsConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15274,103 +15437,145 @@ } /** - * WebhookConfig secret. - * @member {string|null|undefined} secret - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * GitHubEventsConfig installationId. + * @member {number|Long} installationId + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @instance */ - WebhookConfig.prototype.secret = null; + GitHubEventsConfig.prototype.installationId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * WebhookConfig state. - * @member {google.devtools.cloudbuild.v1.WebhookConfig.State} state - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * GitHubEventsConfig owner. + * @member {string} owner + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @instance */ - WebhookConfig.prototype.state = 0; + GitHubEventsConfig.prototype.owner = ""; + + /** + * GitHubEventsConfig name. + * @member {string} name + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @instance + */ + GitHubEventsConfig.prototype.name = ""; + + /** + * GitHubEventsConfig pullRequest. + * @member {google.devtools.cloudbuild.v1.IPullRequestFilter|null|undefined} pullRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @instance + */ + GitHubEventsConfig.prototype.pullRequest = null; + + /** + * GitHubEventsConfig push. + * @member {google.devtools.cloudbuild.v1.IPushFilter|null|undefined} push + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig + * @instance + */ + GitHubEventsConfig.prototype.push = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * WebhookConfig authMethod. - * @member {"secret"|undefined} authMethod - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * GitHubEventsConfig event. + * @member {"pullRequest"|"push"|undefined} event + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @instance */ - Object.defineProperty(WebhookConfig.prototype, "authMethod", { - get: $util.oneOfGetter($oneOfFields = ["secret"]), + Object.defineProperty(GitHubEventsConfig.prototype, "event", { + get: $util.oneOfGetter($oneOfFields = ["pullRequest", "push"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new WebhookConfig instance using the specified properties. + * Creates a new GitHubEventsConfig instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static - * @param {google.devtools.cloudbuild.v1.IWebhookConfig=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig instance + * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig instance */ - WebhookConfig.create = function create(properties) { - return new WebhookConfig(properties); + GitHubEventsConfig.create = function create(properties) { + return new GitHubEventsConfig(properties); }; /** - * Encodes the specified WebhookConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.WebhookConfig.verify|verify} messages. + * Encodes the specified GitHubEventsConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEventsConfig.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static - * @param {google.devtools.cloudbuild.v1.IWebhookConfig} message WebhookConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig} message GitHubEventsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebhookConfig.encode = function encode(message, writer) { + GitHubEventsConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.installationId != null && Object.hasOwnProperty.call(message, "installationId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.installationId); + if (message.pullRequest != null && Object.hasOwnProperty.call(message, "pullRequest")) + $root.google.devtools.cloudbuild.v1.PullRequestFilter.encode(message.pullRequest, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.push != null && Object.hasOwnProperty.call(message, "push")) + $root.google.devtools.cloudbuild.v1.PushFilter.encode(message.push, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.owner != null && Object.hasOwnProperty.call(message, "owner")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.owner); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); return writer; }; /** - * Encodes the specified WebhookConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.WebhookConfig.verify|verify} messages. + * Encodes the specified GitHubEventsConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEventsConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static - * @param {google.devtools.cloudbuild.v1.IWebhookConfig} message WebhookConfig message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEventsConfig} message GitHubEventsConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebhookConfig.encodeDelimited = function encodeDelimited(message, writer) { + GitHubEventsConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebhookConfig message from the specified reader or buffer. + * Decodes a GitHubEventsConfig message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig + * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebhookConfig.decode = function decode(reader, length) { + GitHubEventsConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.WebhookConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitHubEventsConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: { - message.secret = reader.string(); + case 1: { + message.installationId = reader.int64(); + break; + } + case 6: { + message.owner = reader.string(); + break; + } + case 7: { + message.name = reader.string(); break; } case 4: { - message.state = reader.int32(); + message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.decode(reader, reader.uint32()); + break; + } + case 5: { + message.push = $root.google.devtools.cloudbuild.v1.PushFilter.decode(reader, reader.uint32()); break; } default: @@ -15382,177 +15587,195 @@ }; /** - * Decodes a WebhookConfig message from the specified reader or buffer, length delimited. + * Decodes a GitHubEventsConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig + * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebhookConfig.decodeDelimited = function decodeDelimited(reader) { + GitHubEventsConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebhookConfig message. + * Verifies a GitHubEventsConfig message. * @function verify - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebhookConfig.verify = function verify(message) { + GitHubEventsConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.secret != null && message.hasOwnProperty("secret")) { - properties.authMethod = 1; - if (!$util.isString(message.secret)) - return "secret: string expected"; + if (message.installationId != null && message.hasOwnProperty("installationId")) + if (!$util.isInteger(message.installationId) && !(message.installationId && $util.isInteger(message.installationId.low) && $util.isInteger(message.installationId.high))) + return "installationId: integer|Long expected"; + if (message.owner != null && message.hasOwnProperty("owner")) + if (!$util.isString(message.owner)) + return "owner: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { + properties.event = 1; + { + var error = $root.google.devtools.cloudbuild.v1.PullRequestFilter.verify(message.pullRequest); + if (error) + return "pullRequest." + error; + } } - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.push != null && message.hasOwnProperty("push")) { + if (properties.event === 1) + return "event: multiple values"; + properties.event = 1; + { + var error = $root.google.devtools.cloudbuild.v1.PushFilter.verify(message.push); + if (error) + return "push." + error; } + } return null; }; /** - * Creates a WebhookConfig message from a plain object. Also converts values to their respective internal types. + * Creates a GitHubEventsConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig + * @returns {google.devtools.cloudbuild.v1.GitHubEventsConfig} GitHubEventsConfig */ - WebhookConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.WebhookConfig) + GitHubEventsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GitHubEventsConfig) return object; - var message = new $root.google.devtools.cloudbuild.v1.WebhookConfig(); - if (object.secret != null) - message.secret = String(object.secret); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "OK": - case 1: - message.state = 1; - break; - case "SECRET_DELETED": - case 2: - message.state = 2; - break; + var message = new $root.google.devtools.cloudbuild.v1.GitHubEventsConfig(); + if (object.installationId != null) + if ($util.Long) + (message.installationId = $util.Long.fromValue(object.installationId)).unsigned = false; + else if (typeof object.installationId === "string") + message.installationId = parseInt(object.installationId, 10); + else if (typeof object.installationId === "number") + message.installationId = object.installationId; + else if (typeof object.installationId === "object") + message.installationId = new $util.LongBits(object.installationId.low >>> 0, object.installationId.high >>> 0).toNumber(); + if (object.owner != null) + message.owner = String(object.owner); + if (object.name != null) + message.name = String(object.name); + if (object.pullRequest != null) { + if (typeof object.pullRequest !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.GitHubEventsConfig.pullRequest: object expected"); + message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.fromObject(object.pullRequest); + } + if (object.push != null) { + if (typeof object.push !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.GitHubEventsConfig.push: object expected"); + message.push = $root.google.devtools.cloudbuild.v1.PushFilter.fromObject(object.push); } return message; }; /** - * Creates a plain object from a WebhookConfig message. Also converts values to other types if specified. + * Creates a plain object from a GitHubEventsConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static - * @param {google.devtools.cloudbuild.v1.WebhookConfig} message WebhookConfig + * @param {google.devtools.cloudbuild.v1.GitHubEventsConfig} message GitHubEventsConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebhookConfig.toObject = function toObject(message, options) { + GitHubEventsConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - if (message.secret != null && message.hasOwnProperty("secret")) { - object.secret = message.secret; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.installationId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.installationId = options.longs === String ? "0" : 0; + object.owner = ""; + object.name = ""; + } + if (message.installationId != null && message.hasOwnProperty("installationId")) + if (typeof message.installationId === "number") + object.installationId = options.longs === String ? String(message.installationId) : message.installationId; + else + object.installationId = options.longs === String ? $util.Long.prototype.toString.call(message.installationId) : options.longs === Number ? new $util.LongBits(message.installationId.low >>> 0, message.installationId.high >>> 0).toNumber() : message.installationId; + if (message.pullRequest != null && message.hasOwnProperty("pullRequest")) { + object.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.toObject(message.pullRequest, options); if (options.oneofs) - object.authMethod = "secret"; + object.event = "pullRequest"; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.devtools.cloudbuild.v1.WebhookConfig.State[message.state] === undefined ? message.state : $root.google.devtools.cloudbuild.v1.WebhookConfig.State[message.state] : message.state; + if (message.push != null && message.hasOwnProperty("push")) { + object.push = $root.google.devtools.cloudbuild.v1.PushFilter.toObject(message.push, options); + if (options.oneofs) + object.event = "push"; + } + if (message.owner != null && message.hasOwnProperty("owner")) + object.owner = message.owner; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this WebhookConfig to JSON. + * Converts this GitHubEventsConfig to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @instance * @returns {Object.} JSON object */ - WebhookConfig.prototype.toJSON = function toJSON() { + GitHubEventsConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for WebhookConfig + * Gets the default type url for GitHubEventsConfig * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.WebhookConfig + * @memberof google.devtools.cloudbuild.v1.GitHubEventsConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - WebhookConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GitHubEventsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.WebhookConfig"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitHubEventsConfig"; }; - /** - * State enum. - * @name google.devtools.cloudbuild.v1.WebhookConfig.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} OK=1 OK value - * @property {number} SECRET_DELETED=2 SECRET_DELETED value - */ - WebhookConfig.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "OK"] = 1; - values[valuesById[2] = "SECRET_DELETED"] = 2; - return values; - })(); - - return WebhookConfig; + return GitHubEventsConfig; })(); - v1.PullRequestFilter = (function() { + v1.PubsubConfig = (function() { /** - * Properties of a PullRequestFilter. + * Properties of a PubsubConfig. * @memberof google.devtools.cloudbuild.v1 - * @interface IPullRequestFilter - * @property {string|null} [branch] PullRequestFilter branch - * @property {google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl|null} [commentControl] PullRequestFilter commentControl - * @property {boolean|null} [invertRegex] PullRequestFilter invertRegex + * @interface IPubsubConfig + * @property {string|null} [subscription] PubsubConfig subscription + * @property {string|null} [topic] PubsubConfig topic + * @property {string|null} [serviceAccountEmail] PubsubConfig serviceAccountEmail + * @property {google.devtools.cloudbuild.v1.PubsubConfig.State|null} [state] PubsubConfig state */ /** - * Constructs a new PullRequestFilter. + * Constructs a new PubsubConfig. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a PullRequestFilter. - * @implements IPullRequestFilter + * @classdesc Represents a PubsubConfig. + * @implements IPubsubConfig * @constructor - * @param {google.devtools.cloudbuild.v1.IPullRequestFilter=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IPubsubConfig=} [properties] Properties to set */ - function PullRequestFilter(properties) { + function PubsubConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15560,117 +15783,117 @@ } /** - * PullRequestFilter branch. - * @member {string|null|undefined} branch - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * PubsubConfig subscription. + * @member {string} subscription + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @instance */ - PullRequestFilter.prototype.branch = null; + PubsubConfig.prototype.subscription = ""; /** - * PullRequestFilter commentControl. - * @member {google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl} commentControl - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * PubsubConfig topic. + * @member {string} topic + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @instance */ - PullRequestFilter.prototype.commentControl = 0; + PubsubConfig.prototype.topic = ""; /** - * PullRequestFilter invertRegex. - * @member {boolean} invertRegex - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * PubsubConfig serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @instance */ - PullRequestFilter.prototype.invertRegex = false; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + PubsubConfig.prototype.serviceAccountEmail = ""; /** - * PullRequestFilter gitRef. - * @member {"branch"|undefined} gitRef - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * PubsubConfig state. + * @member {google.devtools.cloudbuild.v1.PubsubConfig.State} state + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @instance */ - Object.defineProperty(PullRequestFilter.prototype, "gitRef", { - get: $util.oneOfGetter($oneOfFields = ["branch"]), - set: $util.oneOfSetter($oneOfFields) - }); + PubsubConfig.prototype.state = 0; /** - * Creates a new PullRequestFilter instance using the specified properties. + * Creates a new PubsubConfig instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static - * @param {google.devtools.cloudbuild.v1.IPullRequestFilter=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter instance + * @param {google.devtools.cloudbuild.v1.IPubsubConfig=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig instance */ - PullRequestFilter.create = function create(properties) { - return new PullRequestFilter(properties); + PubsubConfig.create = function create(properties) { + return new PubsubConfig(properties); }; /** - * Encodes the specified PullRequestFilter message. Does not implicitly {@link google.devtools.cloudbuild.v1.PullRequestFilter.verify|verify} messages. + * Encodes the specified PubsubConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.PubsubConfig.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static - * @param {google.devtools.cloudbuild.v1.IPullRequestFilter} message PullRequestFilter message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPubsubConfig} message PubsubConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PullRequestFilter.encode = function encode(message, writer) { + PubsubConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.commentControl != null && Object.hasOwnProperty.call(message, "commentControl")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.commentControl); - if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.invertRegex); + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.topic); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceAccountEmail); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); return writer; }; /** - * Encodes the specified PullRequestFilter message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PullRequestFilter.verify|verify} messages. + * Encodes the specified PubsubConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PubsubConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static - * @param {google.devtools.cloudbuild.v1.IPullRequestFilter} message PullRequestFilter message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPubsubConfig} message PubsubConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PullRequestFilter.encodeDelimited = function encodeDelimited(message, writer) { + PubsubConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PullRequestFilter message from the specified reader or buffer. + * Decodes a PubsubConfig message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter + * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PullRequestFilter.decode = function decode(reader, length) { + PubsubConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PullRequestFilter(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PubsubConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: { + message.subscription = reader.string(); + break; + } case 2: { - message.branch = reader.string(); + message.topic = reader.string(); break; } - case 5: { - message.commentControl = reader.int32(); + case 3: { + message.serviceAccountEmail = reader.string(); break; } - case 6: { - message.invertRegex = reader.bool(); + case 4: { + message.state = reader.int32(); break; } default: @@ -15682,186 +15905,202 @@ }; /** - * Decodes a PullRequestFilter message from the specified reader or buffer, length delimited. + * Decodes a PubsubConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter + * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PullRequestFilter.decodeDelimited = function decodeDelimited(reader) { + PubsubConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PullRequestFilter message. + * Verifies a PubsubConfig message. * @function verify - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PullRequestFilter.verify = function verify(message) { + PubsubConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.branch != null && message.hasOwnProperty("branch")) { - properties.gitRef = 1; - if (!$util.isString(message.branch)) - return "branch: string expected"; - } - if (message.commentControl != null && message.hasOwnProperty("commentControl")) - switch (message.commentControl) { + if (message.subscription != null && message.hasOwnProperty("subscription")) + if (!$util.isString(message.subscription)) + return "subscription: string expected"; + if (message.topic != null && message.hasOwnProperty("topic")) + if (!$util.isString(message.topic)) + return "topic: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { default: - return "commentControl: enum value expected"; + return "state: enum value expected"; case 0: case 1: case 2: + case 3: + case 4: break; } - if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) - if (typeof message.invertRegex !== "boolean") - return "invertRegex: boolean expected"; return null; }; /** - * Creates a PullRequestFilter message from a plain object. Also converts values to their respective internal types. + * Creates a PubsubConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter + * @returns {google.devtools.cloudbuild.v1.PubsubConfig} PubsubConfig */ - PullRequestFilter.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.PullRequestFilter) + PubsubConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.PubsubConfig) return object; - var message = new $root.google.devtools.cloudbuild.v1.PullRequestFilter(); - if (object.branch != null) - message.branch = String(object.branch); - switch (object.commentControl) { + var message = new $root.google.devtools.cloudbuild.v1.PubsubConfig(); + if (object.subscription != null) + message.subscription = String(object.subscription); + if (object.topic != null) + message.topic = String(object.topic); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + switch (object.state) { default: - if (typeof object.commentControl === "number") { - message.commentControl = object.commentControl; + if (typeof object.state === "number") { + message.state = object.state; break; } break; - case "COMMENTS_DISABLED": + case "STATE_UNSPECIFIED": case 0: - message.commentControl = 0; + message.state = 0; break; - case "COMMENTS_ENABLED": + case "OK": case 1: - message.commentControl = 1; + message.state = 1; break; - case "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY": + case "SUBSCRIPTION_DELETED": case 2: - message.commentControl = 2; + message.state = 2; + break; + case "TOPIC_DELETED": + case 3: + message.state = 3; + break; + case "SUBSCRIPTION_MISCONFIGURED": + case 4: + message.state = 4; break; } - if (object.invertRegex != null) - message.invertRegex = Boolean(object.invertRegex); return message; }; /** - * Creates a plain object from a PullRequestFilter message. Also converts values to other types if specified. + * Creates a plain object from a PubsubConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static - * @param {google.devtools.cloudbuild.v1.PullRequestFilter} message PullRequestFilter + * @param {google.devtools.cloudbuild.v1.PubsubConfig} message PubsubConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PullRequestFilter.toObject = function toObject(message, options) { + PubsubConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.commentControl = options.enums === String ? "COMMENTS_DISABLED" : 0; - object.invertRegex = false; - } - if (message.branch != null && message.hasOwnProperty("branch")) { - object.branch = message.branch; - if (options.oneofs) - object.gitRef = "branch"; + object.subscription = ""; + object.topic = ""; + object.serviceAccountEmail = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; } - if (message.commentControl != null && message.hasOwnProperty("commentControl")) - object.commentControl = options.enums === String ? $root.google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl[message.commentControl] === undefined ? message.commentControl : $root.google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl[message.commentControl] : message.commentControl; - if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) - object.invertRegex = message.invertRegex; + if (message.subscription != null && message.hasOwnProperty("subscription")) + object.subscription = message.subscription; + if (message.topic != null && message.hasOwnProperty("topic")) + object.topic = message.topic; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.devtools.cloudbuild.v1.PubsubConfig.State[message.state] === undefined ? message.state : $root.google.devtools.cloudbuild.v1.PubsubConfig.State[message.state] : message.state; return object; }; /** - * Converts this PullRequestFilter to JSON. + * Converts this PubsubConfig to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @instance * @returns {Object.} JSON object */ - PullRequestFilter.prototype.toJSON = function toJSON() { + PubsubConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PullRequestFilter + * Gets the default type url for PubsubConfig * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @memberof google.devtools.cloudbuild.v1.PubsubConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PullRequestFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PubsubConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PullRequestFilter"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PubsubConfig"; }; /** - * CommentControl enum. - * @name google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl + * State enum. + * @name google.devtools.cloudbuild.v1.PubsubConfig.State * @enum {number} - * @property {number} COMMENTS_DISABLED=0 COMMENTS_DISABLED value - * @property {number} COMMENTS_ENABLED=1 COMMENTS_ENABLED value - * @property {number} COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY=2 COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY value + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} OK=1 OK value + * @property {number} SUBSCRIPTION_DELETED=2 SUBSCRIPTION_DELETED value + * @property {number} TOPIC_DELETED=3 TOPIC_DELETED value + * @property {number} SUBSCRIPTION_MISCONFIGURED=4 SUBSCRIPTION_MISCONFIGURED value */ - PullRequestFilter.CommentControl = (function() { + PubsubConfig.State = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "COMMENTS_DISABLED"] = 0; - values[valuesById[1] = "COMMENTS_ENABLED"] = 1; - values[valuesById[2] = "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY"] = 2; + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OK"] = 1; + values[valuesById[2] = "SUBSCRIPTION_DELETED"] = 2; + values[valuesById[3] = "TOPIC_DELETED"] = 3; + values[valuesById[4] = "SUBSCRIPTION_MISCONFIGURED"] = 4; return values; })(); - return PullRequestFilter; + return PubsubConfig; })(); - v1.PushFilter = (function() { + v1.WebhookConfig = (function() { /** - * Properties of a PushFilter. + * Properties of a WebhookConfig. * @memberof google.devtools.cloudbuild.v1 - * @interface IPushFilter - * @property {string|null} [branch] PushFilter branch - * @property {string|null} [tag] PushFilter tag - * @property {boolean|null} [invertRegex] PushFilter invertRegex + * @interface IWebhookConfig + * @property {string|null} [secret] WebhookConfig secret + * @property {google.devtools.cloudbuild.v1.WebhookConfig.State|null} [state] WebhookConfig state */ /** - * Constructs a new PushFilter. + * Constructs a new WebhookConfig. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a PushFilter. - * @implements IPushFilter + * @classdesc Represents a WebhookConfig. + * @implements IWebhookConfig * @constructor - * @param {google.devtools.cloudbuild.v1.IPushFilter=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IWebhookConfig=} [properties] Properties to set */ - function PushFilter(properties) { + function WebhookConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15869,117 +16108,103 @@ } /** - * PushFilter branch. - * @member {string|null|undefined} branch - * @memberof google.devtools.cloudbuild.v1.PushFilter - * @instance - */ - PushFilter.prototype.branch = null; - - /** - * PushFilter tag. - * @member {string|null|undefined} tag - * @memberof google.devtools.cloudbuild.v1.PushFilter + * WebhookConfig secret. + * @member {string|null|undefined} secret + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @instance */ - PushFilter.prototype.tag = null; + WebhookConfig.prototype.secret = null; /** - * PushFilter invertRegex. - * @member {boolean} invertRegex - * @memberof google.devtools.cloudbuild.v1.PushFilter + * WebhookConfig state. + * @member {google.devtools.cloudbuild.v1.WebhookConfig.State} state + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @instance */ - PushFilter.prototype.invertRegex = false; + WebhookConfig.prototype.state = 0; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** - * PushFilter gitRef. - * @member {"branch"|"tag"|undefined} gitRef - * @memberof google.devtools.cloudbuild.v1.PushFilter + * WebhookConfig authMethod. + * @member {"secret"|undefined} authMethod + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @instance */ - Object.defineProperty(PushFilter.prototype, "gitRef", { - get: $util.oneOfGetter($oneOfFields = ["branch", "tag"]), + Object.defineProperty(WebhookConfig.prototype, "authMethod", { + get: $util.oneOfGetter($oneOfFields = ["secret"]), set: $util.oneOfSetter($oneOfFields) }); /** - * Creates a new PushFilter instance using the specified properties. + * Creates a new WebhookConfig instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static - * @param {google.devtools.cloudbuild.v1.IPushFilter=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter instance + * @param {google.devtools.cloudbuild.v1.IWebhookConfig=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig instance */ - PushFilter.create = function create(properties) { - return new PushFilter(properties); + WebhookConfig.create = function create(properties) { + return new WebhookConfig(properties); }; /** - * Encodes the specified PushFilter message. Does not implicitly {@link google.devtools.cloudbuild.v1.PushFilter.verify|verify} messages. + * Encodes the specified WebhookConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.WebhookConfig.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static - * @param {google.devtools.cloudbuild.v1.IPushFilter} message PushFilter message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IWebhookConfig} message WebhookConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PushFilter.encode = function encode(message, writer) { + WebhookConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); - if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.tag); - if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.invertRegex); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); return writer; }; /** - * Encodes the specified PushFilter message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PushFilter.verify|verify} messages. + * Encodes the specified WebhookConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.WebhookConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static - * @param {google.devtools.cloudbuild.v1.IPushFilter} message PushFilter message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IWebhookConfig} message WebhookConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PushFilter.encodeDelimited = function encodeDelimited(message, writer) { + WebhookConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PushFilter message from the specified reader or buffer. + * Decodes a WebhookConfig message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter + * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PushFilter.decode = function decode(reader, length) { + WebhookConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PushFilter(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.WebhookConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: { - message.branch = reader.string(); - break; - } case 3: { - message.tag = reader.string(); + message.secret = reader.string(); break; } case 4: { - message.invertRegex = reader.bool(); + message.state = reader.int32(); break; } default: @@ -15991,151 +16216,177 @@ }; /** - * Decodes a PushFilter message from the specified reader or buffer, length delimited. + * Decodes a WebhookConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter + * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PushFilter.decodeDelimited = function decodeDelimited(reader) { + WebhookConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PushFilter message. + * Verifies a WebhookConfig message. * @function verify - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PushFilter.verify = function verify(message) { + WebhookConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; - if (message.branch != null && message.hasOwnProperty("branch")) { - properties.gitRef = 1; - if (!$util.isString(message.branch)) - return "branch: string expected"; - } - if (message.tag != null && message.hasOwnProperty("tag")) { - if (properties.gitRef === 1) - return "gitRef: multiple values"; - properties.gitRef = 1; - if (!$util.isString(message.tag)) - return "tag: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) { + properties.authMethod = 1; + if (!$util.isString(message.secret)) + return "secret: string expected"; } - if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) - if (typeof message.invertRegex !== "boolean") - return "invertRegex: boolean expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; /** - * Creates a PushFilter message from a plain object. Also converts values to their respective internal types. + * Creates a WebhookConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter + * @returns {google.devtools.cloudbuild.v1.WebhookConfig} WebhookConfig */ - PushFilter.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.PushFilter) + WebhookConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.WebhookConfig) return object; - var message = new $root.google.devtools.cloudbuild.v1.PushFilter(); - if (object.branch != null) - message.branch = String(object.branch); - if (object.tag != null) - message.tag = String(object.tag); - if (object.invertRegex != null) - message.invertRegex = Boolean(object.invertRegex); + var message = new $root.google.devtools.cloudbuild.v1.WebhookConfig(); + if (object.secret != null) + message.secret = String(object.secret); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "OK": + case 1: + message.state = 1; + break; + case "SECRET_DELETED": + case 2: + message.state = 2; + break; + } return message; }; /** - * Creates a plain object from a PushFilter message. Also converts values to other types if specified. + * Creates a plain object from a WebhookConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static - * @param {google.devtools.cloudbuild.v1.PushFilter} message PushFilter + * @param {google.devtools.cloudbuild.v1.WebhookConfig} message WebhookConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PushFilter.toObject = function toObject(message, options) { + WebhookConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.invertRegex = false; - if (message.branch != null && message.hasOwnProperty("branch")) { - object.branch = message.branch; - if (options.oneofs) - object.gitRef = "branch"; - } - if (message.tag != null && message.hasOwnProperty("tag")) { - object.tag = message.tag; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if (message.secret != null && message.hasOwnProperty("secret")) { + object.secret = message.secret; if (options.oneofs) - object.gitRef = "tag"; + object.authMethod = "secret"; } - if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) - object.invertRegex = message.invertRegex; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.devtools.cloudbuild.v1.WebhookConfig.State[message.state] === undefined ? message.state : $root.google.devtools.cloudbuild.v1.WebhookConfig.State[message.state] : message.state; return object; }; /** - * Converts this PushFilter to JSON. + * Converts this WebhookConfig to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @instance * @returns {Object.} JSON object */ - PushFilter.prototype.toJSON = function toJSON() { + WebhookConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for PushFilter + * Gets the default type url for WebhookConfig * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.PushFilter + * @memberof google.devtools.cloudbuild.v1.WebhookConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - PushFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + WebhookConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PushFilter"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.WebhookConfig"; }; - return PushFilter; + /** + * State enum. + * @name google.devtools.cloudbuild.v1.WebhookConfig.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} OK=1 OK value + * @property {number} SECRET_DELETED=2 SECRET_DELETED value + */ + WebhookConfig.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OK"] = 1; + values[valuesById[2] = "SECRET_DELETED"] = 2; + return values; + })(); + + return WebhookConfig; })(); - v1.CreateBuildTriggerRequest = (function() { + v1.PullRequestFilter = (function() { /** - * Properties of a CreateBuildTriggerRequest. + * Properties of a PullRequestFilter. * @memberof google.devtools.cloudbuild.v1 - * @interface ICreateBuildTriggerRequest - * @property {string|null} [parent] CreateBuildTriggerRequest parent - * @property {string|null} [projectId] CreateBuildTriggerRequest projectId - * @property {google.devtools.cloudbuild.v1.IBuildTrigger|null} [trigger] CreateBuildTriggerRequest trigger + * @interface IPullRequestFilter + * @property {string|null} [branch] PullRequestFilter branch + * @property {google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl|null} [commentControl] PullRequestFilter commentControl + * @property {boolean|null} [invertRegex] PullRequestFilter invertRegex */ /** - * Constructs a new CreateBuildTriggerRequest. + * Constructs a new PullRequestFilter. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a CreateBuildTriggerRequest. - * @implements ICreateBuildTriggerRequest + * @classdesc Represents a PullRequestFilter. + * @implements IPullRequestFilter * @constructor - * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IPullRequestFilter=} [properties] Properties to set */ - function CreateBuildTriggerRequest(properties) { + function PullRequestFilter(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16143,103 +16394,117 @@ } /** - * CreateBuildTriggerRequest parent. - * @member {string} parent - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * PullRequestFilter branch. + * @member {string|null|undefined} branch + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @instance */ - CreateBuildTriggerRequest.prototype.parent = ""; + PullRequestFilter.prototype.branch = null; /** - * CreateBuildTriggerRequest projectId. - * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * PullRequestFilter commentControl. + * @member {google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl} commentControl + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @instance */ - CreateBuildTriggerRequest.prototype.projectId = ""; + PullRequestFilter.prototype.commentControl = 0; /** - * CreateBuildTriggerRequest trigger. - * @member {google.devtools.cloudbuild.v1.IBuildTrigger|null|undefined} trigger - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * PullRequestFilter invertRegex. + * @member {boolean} invertRegex + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @instance */ - CreateBuildTriggerRequest.prototype.trigger = null; + PullRequestFilter.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new CreateBuildTriggerRequest instance using the specified properties. + * PullRequestFilter gitRef. + * @member {"branch"|undefined} gitRef + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter + * @instance + */ + Object.defineProperty(PullRequestFilter.prototype, "gitRef", { + get: $util.oneOfGetter($oneOfFields = ["branch"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PullRequestFilter instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static - * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest instance + * @param {google.devtools.cloudbuild.v1.IPullRequestFilter=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter instance */ - CreateBuildTriggerRequest.create = function create(properties) { - return new CreateBuildTriggerRequest(properties); + PullRequestFilter.create = function create(properties) { + return new PullRequestFilter(properties); }; /** - * Encodes the specified CreateBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.verify|verify} messages. + * Encodes the specified PullRequestFilter message. Does not implicitly {@link google.devtools.cloudbuild.v1.PullRequestFilter.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static - * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest} message CreateBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPullRequestFilter} message PullRequestFilter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateBuildTriggerRequest.encode = function encode(message, writer) { + PullRequestFilter.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); - if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) - $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.trigger, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.commentControl != null && Object.hasOwnProperty.call(message, "commentControl")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.commentControl); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.invertRegex); return writer; }; /** - * Encodes the specified CreateBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.verify|verify} messages. + * Encodes the specified PullRequestFilter message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PullRequestFilter.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static - * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest} message CreateBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPullRequestFilter} message PullRequestFilter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + PullRequestFilter.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateBuildTriggerRequest message from the specified reader or buffer. + * Decodes a PullRequestFilter message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateBuildTriggerRequest.decode = function decode(reader, length) { + PullRequestFilter.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PullRequestFilter(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: { - message.parent = reader.string(); + case 2: { + message.branch = reader.string(); break; } - case 1: { - message.projectId = reader.string(); + case 5: { + message.commentControl = reader.int32(); break; } - case 2: { - message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32()); + case 6: { + message.invertRegex = reader.bool(); break; } default: @@ -16251,146 +16516,186 @@ }; /** - * Decodes a CreateBuildTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a PullRequestFilter message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + PullRequestFilter.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateBuildTriggerRequest message. + * Verifies a PullRequestFilter message. * @function verify - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateBuildTriggerRequest.verify = function verify(message) { + PullRequestFilter.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.trigger); - if (error) - return "trigger." + error; + var properties = {}; + if (message.branch != null && message.hasOwnProperty("branch")) { + properties.gitRef = 1; + if (!$util.isString(message.branch)) + return "branch: string expected"; } + if (message.commentControl != null && message.hasOwnProperty("commentControl")) + switch (message.commentControl) { + default: + return "commentControl: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; return null; }; /** - * Creates a CreateBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a PullRequestFilter message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.PullRequestFilter} PullRequestFilter */ - CreateBuildTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest) + PullRequestFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.PullRequestFilter) return object; - var message = new $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.trigger != null) { - if (typeof object.trigger !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.trigger: object expected"); - message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.trigger); + var message = new $root.google.devtools.cloudbuild.v1.PullRequestFilter(); + if (object.branch != null) + message.branch = String(object.branch); + switch (object.commentControl) { + default: + if (typeof object.commentControl === "number") { + message.commentControl = object.commentControl; + break; + } + break; + case "COMMENTS_DISABLED": + case 0: + message.commentControl = 0; + break; + case "COMMENTS_ENABLED": + case 1: + message.commentControl = 1; + break; + case "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY": + case 2: + message.commentControl = 2; + break; } + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); return message; }; /** - * Creates a plain object from a CreateBuildTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a PullRequestFilter message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static - * @param {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} message CreateBuildTriggerRequest + * @param {google.devtools.cloudbuild.v1.PullRequestFilter} message PullRequestFilter * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateBuildTriggerRequest.toObject = function toObject(message, options) { + PullRequestFilter.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.projectId = ""; - object.trigger = null; - object.parent = ""; + object.commentControl = options.enums === String ? "COMMENTS_DISABLED" : 0; + object.invertRegex = false; } - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.trigger != null && message.hasOwnProperty("trigger")) - object.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.trigger, options); - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; + if (message.branch != null && message.hasOwnProperty("branch")) { + object.branch = message.branch; + if (options.oneofs) + object.gitRef = "branch"; + } + if (message.commentControl != null && message.hasOwnProperty("commentControl")) + object.commentControl = options.enums === String ? $root.google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl[message.commentControl] === undefined ? message.commentControl : $root.google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl[message.commentControl] : message.commentControl; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; return object; }; /** - * Converts this CreateBuildTriggerRequest to JSON. + * Converts this PullRequestFilter to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @instance * @returns {Object.} JSON object */ - CreateBuildTriggerRequest.prototype.toJSON = function toJSON() { + PullRequestFilter.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for CreateBuildTriggerRequest + * Gets the default type url for PullRequestFilter * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PullRequestFilter * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - CreateBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PullRequestFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PullRequestFilter"; }; - return CreateBuildTriggerRequest; + /** + * CommentControl enum. + * @name google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl + * @enum {number} + * @property {number} COMMENTS_DISABLED=0 COMMENTS_DISABLED value + * @property {number} COMMENTS_ENABLED=1 COMMENTS_ENABLED value + * @property {number} COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY=2 COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY value + */ + PullRequestFilter.CommentControl = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMMENTS_DISABLED"] = 0; + values[valuesById[1] = "COMMENTS_ENABLED"] = 1; + values[valuesById[2] = "COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY"] = 2; + return values; + })(); + + return PullRequestFilter; })(); - v1.GetBuildTriggerRequest = (function() { + v1.PushFilter = (function() { /** - * Properties of a GetBuildTriggerRequest. + * Properties of a PushFilter. * @memberof google.devtools.cloudbuild.v1 - * @interface IGetBuildTriggerRequest - * @property {string|null} [name] GetBuildTriggerRequest name - * @property {string|null} [projectId] GetBuildTriggerRequest projectId - * @property {string|null} [triggerId] GetBuildTriggerRequest triggerId + * @interface IPushFilter + * @property {string|null} [branch] PushFilter branch + * @property {string|null} [tag] PushFilter tag + * @property {boolean|null} [invertRegex] PushFilter invertRegex */ /** - * Constructs a new GetBuildTriggerRequest. + * Constructs a new PushFilter. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a GetBuildTriggerRequest. - * @implements IGetBuildTriggerRequest + * @classdesc Represents a PushFilter. + * @implements IPushFilter * @constructor - * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IPushFilter=} [properties] Properties to set */ - function GetBuildTriggerRequest(properties) { + function PushFilter(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16398,103 +16703,117 @@ } /** - * GetBuildTriggerRequest name. - * @member {string} name - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * PushFilter branch. + * @member {string|null|undefined} branch + * @memberof google.devtools.cloudbuild.v1.PushFilter * @instance */ - GetBuildTriggerRequest.prototype.name = ""; + PushFilter.prototype.branch = null; /** - * GetBuildTriggerRequest projectId. - * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * PushFilter tag. + * @member {string|null|undefined} tag + * @memberof google.devtools.cloudbuild.v1.PushFilter * @instance */ - GetBuildTriggerRequest.prototype.projectId = ""; + PushFilter.prototype.tag = null; /** - * GetBuildTriggerRequest triggerId. - * @member {string} triggerId - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * PushFilter invertRegex. + * @member {boolean} invertRegex + * @memberof google.devtools.cloudbuild.v1.PushFilter * @instance */ - GetBuildTriggerRequest.prototype.triggerId = ""; + PushFilter.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Creates a new GetBuildTriggerRequest instance using the specified properties. + * PushFilter gitRef. + * @member {"branch"|"tag"|undefined} gitRef + * @memberof google.devtools.cloudbuild.v1.PushFilter + * @instance + */ + Object.defineProperty(PushFilter.prototype, "gitRef", { + get: $util.oneOfGetter($oneOfFields = ["branch", "tag"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PushFilter instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static - * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest instance + * @param {google.devtools.cloudbuild.v1.IPushFilter=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter instance */ - GetBuildTriggerRequest.create = function create(properties) { - return new GetBuildTriggerRequest(properties); + PushFilter.create = function create(properties) { + return new PushFilter(properties); }; /** - * Encodes the specified GetBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.GetBuildTriggerRequest.verify|verify} messages. + * Encodes the specified PushFilter message. Does not implicitly {@link google.devtools.cloudbuild.v1.PushFilter.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static - * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest} message GetBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPushFilter} message PushFilter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBuildTriggerRequest.encode = function encode(message, writer) { + PushFilter.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); - if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.branch != null && Object.hasOwnProperty.call(message, "branch")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.branch); + if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tag); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.invertRegex); return writer; }; /** - * Encodes the specified GetBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GetBuildTriggerRequest.verify|verify} messages. + * Encodes the specified PushFilter message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.PushFilter.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static - * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest} message GetBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IPushFilter} message PushFilter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + PushFilter.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetBuildTriggerRequest message from the specified reader or buffer. + * Decodes a PushFilter message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBuildTriggerRequest.decode = function decode(reader, length) { + PushFilter.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.PushFilter(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: { - message.name = reader.string(); + case 2: { + message.branch = reader.string(); break; } - case 1: { - message.projectId = reader.string(); + case 3: { + message.tag = reader.string(); break; } - case 2: { - message.triggerId = reader.string(); + case 4: { + message.invertRegex = reader.bool(); break; } default: @@ -16506,142 +16825,151 @@ }; /** - * Decodes a GetBuildTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a PushFilter message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + PushFilter.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetBuildTriggerRequest message. + * Verifies a PushFilter message. * @function verify - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetBuildTriggerRequest.verify = function verify(message) { + PushFilter.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - if (!$util.isString(message.triggerId)) - return "triggerId: string expected"; - return null; - }; - - /** - * Creates a GetBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest - * @static - * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest - */ - GetBuildTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest) - return object; - var message = new $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.triggerId != null) - message.triggerId = String(object.triggerId); + var properties = {}; + if (message.branch != null && message.hasOwnProperty("branch")) { + properties.gitRef = 1; + if (!$util.isString(message.branch)) + return "branch: string expected"; + } + if (message.tag != null && message.hasOwnProperty("tag")) { + if (properties.gitRef === 1) + return "gitRef: multiple values"; + properties.gitRef = 1; + if (!$util.isString(message.tag)) + return "tag: string expected"; + } + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; + return null; + }; + + /** + * Creates a PushFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.PushFilter + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.PushFilter} PushFilter + */ + PushFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.PushFilter) + return object; + var message = new $root.google.devtools.cloudbuild.v1.PushFilter(); + if (object.branch != null) + message.branch = String(object.branch); + if (object.tag != null) + message.tag = String(object.tag); + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); return message; }; /** - * Creates a plain object from a GetBuildTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a PushFilter message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static - * @param {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} message GetBuildTriggerRequest + * @param {google.devtools.cloudbuild.v1.PushFilter} message PushFilter * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetBuildTriggerRequest.toObject = function toObject(message, options) { + PushFilter.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.projectId = ""; - object.triggerId = ""; - object.name = ""; + if (options.defaults) + object.invertRegex = false; + if (message.branch != null && message.hasOwnProperty("branch")) { + object.branch = message.branch; + if (options.oneofs) + object.gitRef = "branch"; } - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - object.triggerId = message.triggerId; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (message.tag != null && message.hasOwnProperty("tag")) { + object.tag = message.tag; + if (options.oneofs) + object.gitRef = "tag"; + } + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; return object; }; /** - * Converts this GetBuildTriggerRequest to JSON. + * Converts this PushFilter to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @instance * @returns {Object.} JSON object */ - GetBuildTriggerRequest.prototype.toJSON = function toJSON() { + PushFilter.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetBuildTriggerRequest + * Gets the default type url for PushFilter * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.PushFilter * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + PushFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.PushFilter"; }; - return GetBuildTriggerRequest; + return PushFilter; })(); - v1.ListBuildTriggersRequest = (function() { + v1.CreateBuildTriggerRequest = (function() { /** - * Properties of a ListBuildTriggersRequest. + * Properties of a CreateBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @interface IListBuildTriggersRequest - * @property {string|null} [parent] ListBuildTriggersRequest parent - * @property {string|null} [projectId] ListBuildTriggersRequest projectId - * @property {number|null} [pageSize] ListBuildTriggersRequest pageSize - * @property {string|null} [pageToken] ListBuildTriggersRequest pageToken + * @interface ICreateBuildTriggerRequest + * @property {string|null} [parent] CreateBuildTriggerRequest parent + * @property {string|null} [projectId] CreateBuildTriggerRequest projectId + * @property {google.devtools.cloudbuild.v1.IBuildTrigger|null} [trigger] CreateBuildTriggerRequest trigger */ /** - * Constructs a new ListBuildTriggersRequest. + * Constructs a new CreateBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a ListBuildTriggersRequest. - * @implements IListBuildTriggersRequest + * @classdesc Represents a CreateBuildTriggerRequest. + * @implements ICreateBuildTriggerRequest * @constructor - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest=} [properties] Properties to set */ - function ListBuildTriggersRequest(properties) { + function CreateBuildTriggerRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16649,104 +16977,94 @@ } /** - * ListBuildTriggersRequest parent. + * CreateBuildTriggerRequest parent. * @member {string} parent - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @instance */ - ListBuildTriggersRequest.prototype.parent = ""; + CreateBuildTriggerRequest.prototype.parent = ""; /** - * ListBuildTriggersRequest projectId. + * CreateBuildTriggerRequest projectId. * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest - * @instance - */ - ListBuildTriggersRequest.prototype.projectId = ""; - - /** - * ListBuildTriggersRequest pageSize. - * @member {number} pageSize - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @instance */ - ListBuildTriggersRequest.prototype.pageSize = 0; + CreateBuildTriggerRequest.prototype.projectId = ""; /** - * ListBuildTriggersRequest pageToken. - * @member {string} pageToken - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * CreateBuildTriggerRequest trigger. + * @member {google.devtools.cloudbuild.v1.IBuildTrigger|null|undefined} trigger + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @instance */ - ListBuildTriggersRequest.prototype.pageToken = ""; + CreateBuildTriggerRequest.prototype.trigger = null; /** - * Creates a new ListBuildTriggersRequest instance using the specified properties. + * Creates a new CreateBuildTriggerRequest instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest instance + * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest instance */ - ListBuildTriggersRequest.create = function create(properties) { - return new ListBuildTriggersRequest(properties); + CreateBuildTriggerRequest.create = function create(properties) { + return new CreateBuildTriggerRequest(properties); }; /** - * Encodes the specified ListBuildTriggersRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersRequest.verify|verify} messages. + * Encodes the specified CreateBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest} message ListBuildTriggersRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest} message CreateBuildTriggerRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListBuildTriggersRequest.encode = function encode(message, writer) { + CreateBuildTriggerRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.trigger, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); + writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); return writer; }; /** - * Encodes the specified ListBuildTriggersRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersRequest.verify|verify} messages. + * Encodes the specified CreateBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest} message ListBuildTriggersRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.ICreateBuildTriggerRequest} message CreateBuildTriggerRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListBuildTriggersRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListBuildTriggersRequest message from the specified reader or buffer. + * Decodes a CreateBuildTriggerRequest message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest + * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListBuildTriggersRequest.decode = function decode(reader, length) { + CreateBuildTriggerRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: { + case 3: { message.parent = reader.string(); break; } @@ -16755,11 +17073,7 @@ break; } case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); + message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32()); break; } default: @@ -16771,30 +17085,30 @@ }; /** - * Decodes a ListBuildTriggersRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateBuildTriggerRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest + * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListBuildTriggersRequest.decodeDelimited = function decodeDelimited(reader) { + CreateBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListBuildTriggersRequest message. + * Verifies a CreateBuildTriggerRequest message. * @function verify - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListBuildTriggersRequest.verify = function verify(message) { + CreateBuildTriggerRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) @@ -16803,117 +17117,114 @@ if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.trigger); + if (error) + return "trigger." + error; + } return null; }; /** - * Creates a ListBuildTriggersRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest + * @returns {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} CreateBuildTriggerRequest */ - ListBuildTriggersRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest) + CreateBuildTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest) return object; - var message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest(); + var message = new $root.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.projectId != null) message.projectId = String(object.projectId); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.trigger: object expected"); + message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.trigger); + } return message; }; /** - * Creates a plain object from a ListBuildTriggersRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateBuildTriggerRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} message ListBuildTriggersRequest + * @param {google.devtools.cloudbuild.v1.CreateBuildTriggerRequest} message CreateBuildTriggerRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListBuildTriggersRequest.toObject = function toObject(message, options) { + CreateBuildTriggerRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.projectId = ""; - object.pageSize = 0; - object.pageToken = ""; + object.trigger = null; object.parent = ""; } if (message.projectId != null && message.hasOwnProperty("projectId")) object.projectId = message.projectId; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.trigger, options); if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; return object; }; /** - * Converts this ListBuildTriggersRequest to JSON. + * Converts this CreateBuildTriggerRequest to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @instance * @returns {Object.} JSON object */ - ListBuildTriggersRequest.prototype.toJSON = function toJSON() { + CreateBuildTriggerRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListBuildTriggersRequest + * Gets the default type url for CreateBuildTriggerRequest * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @memberof google.devtools.cloudbuild.v1.CreateBuildTriggerRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListBuildTriggersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CreateBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.CreateBuildTriggerRequest"; }; - return ListBuildTriggersRequest; + return CreateBuildTriggerRequest; })(); - v1.ListBuildTriggersResponse = (function() { + v1.GetBuildTriggerRequest = (function() { /** - * Properties of a ListBuildTriggersResponse. + * Properties of a GetBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @interface IListBuildTriggersResponse - * @property {Array.|null} [triggers] ListBuildTriggersResponse triggers - * @property {string|null} [nextPageToken] ListBuildTriggersResponse nextPageToken + * @interface IGetBuildTriggerRequest + * @property {string|null} [name] GetBuildTriggerRequest name + * @property {string|null} [projectId] GetBuildTriggerRequest projectId + * @property {string|null} [triggerId] GetBuildTriggerRequest triggerId */ /** - * Constructs a new ListBuildTriggersResponse. + * Constructs a new GetBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a ListBuildTriggersResponse. - * @implements IListBuildTriggersResponse + * @classdesc Represents a GetBuildTriggerRequest. + * @implements IGetBuildTriggerRequest * @constructor - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest=} [properties] Properties to set */ - function ListBuildTriggersResponse(properties) { - this.triggers = []; + function GetBuildTriggerRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16921,92 +17232,103 @@ } /** - * ListBuildTriggersResponse triggers. - * @member {Array.} triggers - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * GetBuildTriggerRequest name. + * @member {string} name + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @instance */ - ListBuildTriggersResponse.prototype.triggers = $util.emptyArray; + GetBuildTriggerRequest.prototype.name = ""; /** - * ListBuildTriggersResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * GetBuildTriggerRequest projectId. + * @member {string} projectId + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @instance */ - ListBuildTriggersResponse.prototype.nextPageToken = ""; + GetBuildTriggerRequest.prototype.projectId = ""; /** - * Creates a new ListBuildTriggersResponse instance using the specified properties. + * GetBuildTriggerRequest triggerId. + * @member {string} triggerId + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest + * @instance + */ + GetBuildTriggerRequest.prototype.triggerId = ""; + + /** + * Creates a new GetBuildTriggerRequest instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse instance + * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest instance */ - ListBuildTriggersResponse.create = function create(properties) { - return new ListBuildTriggersResponse(properties); + GetBuildTriggerRequest.create = function create(properties) { + return new GetBuildTriggerRequest(properties); }; /** - * Encodes the specified ListBuildTriggersResponse message. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersResponse.verify|verify} messages. + * Encodes the specified GetBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.GetBuildTriggerRequest.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse} message ListBuildTriggersResponse message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest} message GetBuildTriggerRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListBuildTriggersResponse.encode = function encode(message, writer) { + GetBuildTriggerRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.triggers != null && message.triggers.length) - for (var i = 0; i < message.triggers.length; ++i) - $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.triggers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); return writer; }; /** - * Encodes the specified ListBuildTriggersResponse message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersResponse.verify|verify} messages. + * Encodes the specified GetBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GetBuildTriggerRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse} message ListBuildTriggersResponse message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGetBuildTriggerRequest} message GetBuildTriggerRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListBuildTriggersResponse.encodeDelimited = function encodeDelimited(message, writer) { + GetBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListBuildTriggersResponse message from the specified reader or buffer. + * Decodes a GetBuildTriggerRequest message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse + * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListBuildTriggersResponse.decode = function decode(reader, length) { + GetBuildTriggerRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } case 1: { - if (!(message.triggers && message.triggers.length)) - message.triggers = []; - message.triggers.push($root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32())); + message.projectId = reader.string(); break; } case 2: { - message.nextPageToken = reader.string(); + message.triggerId = reader.string(); break; } default: @@ -17018,150 +17340,142 @@ }; /** - * Decodes a ListBuildTriggersResponse message from the specified reader or buffer, length delimited. + * Decodes a GetBuildTriggerRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse + * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListBuildTriggersResponse.decodeDelimited = function decodeDelimited(reader) { + GetBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListBuildTriggersResponse message. + * Verifies a GetBuildTriggerRequest message. * @function verify - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListBuildTriggersResponse.verify = function verify(message) { + GetBuildTriggerRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.triggers != null && message.hasOwnProperty("triggers")) { - if (!Array.isArray(message.triggers)) - return "triggers: array expected"; - for (var i = 0; i < message.triggers.length; ++i) { - var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.triggers[i]); - if (error) - return "triggers." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + if (!$util.isString(message.triggerId)) + return "triggerId: string expected"; return null; }; /** - * Creates a ListBuildTriggersResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GetBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse + * @returns {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} GetBuildTriggerRequest */ - ListBuildTriggersResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse) + GetBuildTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest) return object; - var message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse(); - if (object.triggers) { - if (!Array.isArray(object.triggers)) - throw TypeError(".google.devtools.cloudbuild.v1.ListBuildTriggersResponse.triggers: array expected"); - message.triggers = []; - for (var i = 0; i < object.triggers.length; ++i) { - if (typeof object.triggers[i] !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.ListBuildTriggersResponse.triggers: object expected"); - message.triggers[i] = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.triggers[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); + var message = new $root.google.devtools.cloudbuild.v1.GetBuildTriggerRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.triggerId != null) + message.triggerId = String(object.triggerId); return message; }; /** - * Creates a plain object from a ListBuildTriggersResponse message. Also converts values to other types if specified. + * Creates a plain object from a GetBuildTriggerRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static - * @param {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} message ListBuildTriggersResponse + * @param {google.devtools.cloudbuild.v1.GetBuildTriggerRequest} message GetBuildTriggerRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListBuildTriggersResponse.toObject = function toObject(message, options) { + GetBuildTriggerRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.triggers = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.triggers && message.triggers.length) { - object.triggers = []; - for (var j = 0; j < message.triggers.length; ++j) - object.triggers[j] = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.triggers[j], options); + if (options.defaults) { + object.projectId = ""; + object.triggerId = ""; + object.name = ""; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + object.triggerId = message.triggerId; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ListBuildTriggersResponse to JSON. + * Converts this GetBuildTriggerRequest to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @instance * @returns {Object.} JSON object */ - ListBuildTriggersResponse.prototype.toJSON = function toJSON() { + GetBuildTriggerRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListBuildTriggersResponse + * Gets the default type url for GetBuildTriggerRequest * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse + * @memberof google.devtools.cloudbuild.v1.GetBuildTriggerRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListBuildTriggersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GetBuildTriggerRequest"; }; - return ListBuildTriggersResponse; + return GetBuildTriggerRequest; })(); - v1.DeleteBuildTriggerRequest = (function() { + v1.ListBuildTriggersRequest = (function() { /** - * Properties of a DeleteBuildTriggerRequest. + * Properties of a ListBuildTriggersRequest. * @memberof google.devtools.cloudbuild.v1 - * @interface IDeleteBuildTriggerRequest - * @property {string|null} [name] DeleteBuildTriggerRequest name - * @property {string|null} [projectId] DeleteBuildTriggerRequest projectId - * @property {string|null} [triggerId] DeleteBuildTriggerRequest triggerId + * @interface IListBuildTriggersRequest + * @property {string|null} [parent] ListBuildTriggersRequest parent + * @property {string|null} [projectId] ListBuildTriggersRequest projectId + * @property {number|null} [pageSize] ListBuildTriggersRequest pageSize + * @property {string|null} [pageToken] ListBuildTriggersRequest pageToken */ /** - * Constructs a new DeleteBuildTriggerRequest. + * Constructs a new ListBuildTriggersRequest. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a DeleteBuildTriggerRequest. - * @implements IDeleteBuildTriggerRequest + * @classdesc Represents a ListBuildTriggersRequest. + * @implements IListBuildTriggersRequest * @constructor - * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest=} [properties] Properties to set */ - function DeleteBuildTriggerRequest(properties) { + function ListBuildTriggersRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17169,95 +17483,105 @@ } /** - * DeleteBuildTriggerRequest name. - * @member {string} name - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * ListBuildTriggersRequest parent. + * @member {string} parent + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @instance */ - DeleteBuildTriggerRequest.prototype.name = ""; + ListBuildTriggersRequest.prototype.parent = ""; /** - * DeleteBuildTriggerRequest projectId. + * ListBuildTriggersRequest projectId. * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @instance */ - DeleteBuildTriggerRequest.prototype.projectId = ""; + ListBuildTriggersRequest.prototype.projectId = ""; /** - * DeleteBuildTriggerRequest triggerId. - * @member {string} triggerId - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * ListBuildTriggersRequest pageSize. + * @member {number} pageSize + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @instance */ - DeleteBuildTriggerRequest.prototype.triggerId = ""; + ListBuildTriggersRequest.prototype.pageSize = 0; /** - * Creates a new DeleteBuildTriggerRequest instance using the specified properties. + * ListBuildTriggersRequest pageToken. + * @member {string} pageToken + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest + * @instance + */ + ListBuildTriggersRequest.prototype.pageToken = ""; + + /** + * Creates a new ListBuildTriggersRequest instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static - * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest instance + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest instance */ - DeleteBuildTriggerRequest.create = function create(properties) { - return new DeleteBuildTriggerRequest(properties); + ListBuildTriggersRequest.create = function create(properties) { + return new ListBuildTriggersRequest(properties); }; /** - * Encodes the specified DeleteBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.verify|verify} messages. + * Encodes the specified ListBuildTriggersRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersRequest.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static - * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest} message DeleteBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest} message ListBuildTriggersRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteBuildTriggerRequest.encode = function encode(message, writer) { + ListBuildTriggersRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); - if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); return writer; }; /** - * Encodes the specified DeleteBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.verify|verify} messages. + * Encodes the specified ListBuildTriggersRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static - * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest} message DeleteBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersRequest} message ListBuildTriggersRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListBuildTriggersRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteBuildTriggerRequest message from the specified reader or buffer. + * Decodes a ListBuildTriggersRequest message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteBuildTriggerRequest.decode = function decode(reader, length) { + ListBuildTriggersRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: { - message.name = reader.string(); + case 4: { + message.parent = reader.string(); break; } case 1: { @@ -17265,7 +17589,11 @@ break; } case 2: { - message.triggerId = reader.string(); + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); break; } default: @@ -17277,141 +17605,149 @@ }; /** - * Decodes a DeleteBuildTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a ListBuildTriggersRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + ListBuildTriggersRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteBuildTriggerRequest message. + * Verifies a ListBuildTriggersRequest message. * @function verify - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteBuildTriggerRequest.verify = function verify(message) { + ListBuildTriggersRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - if (!$util.isString(message.triggerId)) - return "triggerId: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates a DeleteBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListBuildTriggersRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} ListBuildTriggersRequest */ - DeleteBuildTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest) + ListBuildTriggersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest) return object; - var message = new $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersRequest(); + if (object.parent != null) + message.parent = String(object.parent); if (object.projectId != null) message.projectId = String(object.projectId); - if (object.triggerId != null) - message.triggerId = String(object.triggerId); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from a DeleteBuildTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListBuildTriggersRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static - * @param {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} message DeleteBuildTriggerRequest + * @param {google.devtools.cloudbuild.v1.ListBuildTriggersRequest} message ListBuildTriggersRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteBuildTriggerRequest.toObject = function toObject(message, options) { + ListBuildTriggersRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.projectId = ""; - object.triggerId = ""; - object.name = ""; + object.pageSize = 0; + object.pageToken = ""; + object.parent = ""; } if (message.projectId != null && message.hasOwnProperty("projectId")) object.projectId = message.projectId; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - object.triggerId = message.triggerId; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this DeleteBuildTriggerRequest to JSON. + * Converts this ListBuildTriggersRequest to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @instance * @returns {Object.} JSON object */ - DeleteBuildTriggerRequest.prototype.toJSON = function toJSON() { + ListBuildTriggersRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DeleteBuildTriggerRequest + * Gets the default type url for ListBuildTriggersRequest * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DeleteBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListBuildTriggersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ListBuildTriggersRequest"; }; - return DeleteBuildTriggerRequest; + return ListBuildTriggersRequest; })(); - v1.UpdateBuildTriggerRequest = (function() { + v1.ListBuildTriggersResponse = (function() { /** - * Properties of an UpdateBuildTriggerRequest. + * Properties of a ListBuildTriggersResponse. * @memberof google.devtools.cloudbuild.v1 - * @interface IUpdateBuildTriggerRequest - * @property {string|null} [projectId] UpdateBuildTriggerRequest projectId - * @property {string|null} [triggerId] UpdateBuildTriggerRequest triggerId - * @property {google.devtools.cloudbuild.v1.IBuildTrigger|null} [trigger] UpdateBuildTriggerRequest trigger + * @interface IListBuildTriggersResponse + * @property {Array.|null} [triggers] ListBuildTriggersResponse triggers + * @property {string|null} [nextPageToken] ListBuildTriggersResponse nextPageToken */ /** - * Constructs a new UpdateBuildTriggerRequest. + * Constructs a new ListBuildTriggersResponse. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents an UpdateBuildTriggerRequest. - * @implements IUpdateBuildTriggerRequest + * @classdesc Represents a ListBuildTriggersResponse. + * @implements IListBuildTriggersResponse * @constructor - * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse=} [properties] Properties to set */ - function UpdateBuildTriggerRequest(properties) { + function ListBuildTriggersResponse(properties) { + this.triggers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17419,103 +17755,92 @@ } /** - * UpdateBuildTriggerRequest projectId. - * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest - * @instance - */ - UpdateBuildTriggerRequest.prototype.projectId = ""; - - /** - * UpdateBuildTriggerRequest triggerId. - * @member {string} triggerId - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * ListBuildTriggersResponse triggers. + * @member {Array.} triggers + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @instance */ - UpdateBuildTriggerRequest.prototype.triggerId = ""; + ListBuildTriggersResponse.prototype.triggers = $util.emptyArray; /** - * UpdateBuildTriggerRequest trigger. - * @member {google.devtools.cloudbuild.v1.IBuildTrigger|null|undefined} trigger - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * ListBuildTriggersResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @instance */ - UpdateBuildTriggerRequest.prototype.trigger = null; + ListBuildTriggersResponse.prototype.nextPageToken = ""; /** - * Creates a new UpdateBuildTriggerRequest instance using the specified properties. + * Creates a new ListBuildTriggersResponse instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static - * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest instance + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse instance */ - UpdateBuildTriggerRequest.create = function create(properties) { - return new UpdateBuildTriggerRequest(properties); + ListBuildTriggersResponse.create = function create(properties) { + return new ListBuildTriggersResponse(properties); }; /** - * Encodes the specified UpdateBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.verify|verify} messages. + * Encodes the specified ListBuildTriggersResponse message. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersResponse.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static - * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest} message UpdateBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse} message ListBuildTriggersResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateBuildTriggerRequest.encode = function encode(message, writer) { + ListBuildTriggersResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); - if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); - if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) - $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.trigger, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.triggers != null && message.triggers.length) + for (var i = 0; i < message.triggers.length; ++i) + $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.triggers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified UpdateBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.verify|verify} messages. + * Encodes the specified ListBuildTriggersResponse message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ListBuildTriggersResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static - * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest} message UpdateBuildTriggerRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IListBuildTriggersResponse} message ListBuildTriggersResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListBuildTriggersResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateBuildTriggerRequest message from the specified reader or buffer. + * Decodes a ListBuildTriggersResponse message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateBuildTriggerRequest.decode = function decode(reader, length) { + ListBuildTriggersResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.projectId = reader.string(); + if (!(message.triggers && message.triggers.length)) + message.triggers = []; + message.triggers.push($root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32())); break; } case 2: { - message.triggerId = reader.string(); - break; - } - case 3: { - message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; } default: @@ -17527,161 +17852,150 @@ }; /** - * Decodes an UpdateBuildTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a ListBuildTriggersResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + ListBuildTriggersResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateBuildTriggerRequest message. + * Verifies a ListBuildTriggersResponse message. * @function verify - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateBuildTriggerRequest.verify = function verify(message) { + ListBuildTriggersResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - if (!$util.isString(message.triggerId)) - return "triggerId: string expected"; - if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.trigger); - if (error) - return "trigger." + error; + if (message.triggers != null && message.hasOwnProperty("triggers")) { + if (!Array.isArray(message.triggers)) + return "triggers: array expected"; + for (var i = 0; i < message.triggers.length; ++i) { + var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.triggers[i]); + if (error) + return "triggers." + error; + } } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates an UpdateBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListBuildTriggersResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + * @returns {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} ListBuildTriggersResponse */ - UpdateBuildTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest) + ListBuildTriggersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse) return object; - var message = new $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest(); - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.triggerId != null) - message.triggerId = String(object.triggerId); - if (object.trigger != null) { - if (typeof object.trigger !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.trigger: object expected"); - message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.trigger); + var message = new $root.google.devtools.cloudbuild.v1.ListBuildTriggersResponse(); + if (object.triggers) { + if (!Array.isArray(object.triggers)) + throw TypeError(".google.devtools.cloudbuild.v1.ListBuildTriggersResponse.triggers: array expected"); + message.triggers = []; + for (var i = 0; i < object.triggers.length; ++i) { + if (typeof object.triggers[i] !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.ListBuildTriggersResponse.triggers: object expected"); + message.triggers[i] = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.triggers[i]); + } } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from an UpdateBuildTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListBuildTriggersResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static - * @param {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} message UpdateBuildTriggerRequest + * @param {google.devtools.cloudbuild.v1.ListBuildTriggersResponse} message ListBuildTriggersResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateBuildTriggerRequest.toObject = function toObject(message, options) { + ListBuildTriggersResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.projectId = ""; - object.triggerId = ""; - object.trigger = null; + if (options.arrays || options.defaults) + object.triggers = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.triggers && message.triggers.length) { + object.triggers = []; + for (var j = 0; j < message.triggers.length; ++j) + object.triggers[j] = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.triggers[j], options); } - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - object.triggerId = message.triggerId; - if (message.trigger != null && message.hasOwnProperty("trigger")) - object.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.trigger, options); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this UpdateBuildTriggerRequest to JSON. + * Converts this ListBuildTriggersResponse to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @instance * @returns {Object.} JSON object */ - UpdateBuildTriggerRequest.prototype.toJSON = function toJSON() { + ListBuildTriggersResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for UpdateBuildTriggerRequest + * Gets the default type url for ListBuildTriggersResponse * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @memberof google.devtools.cloudbuild.v1.ListBuildTriggersResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - UpdateBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListBuildTriggersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ListBuildTriggersResponse"; }; - return UpdateBuildTriggerRequest; + return ListBuildTriggersResponse; })(); - v1.BuildOptions = (function() { + v1.DeleteBuildTriggerRequest = (function() { /** - * Properties of a BuildOptions. + * Properties of a DeleteBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @interface IBuildOptions - * @property {Array.|null} [sourceProvenanceHash] BuildOptions sourceProvenanceHash - * @property {google.devtools.cloudbuild.v1.BuildOptions.VerifyOption|null} [requestedVerifyOption] BuildOptions requestedVerifyOption - * @property {google.devtools.cloudbuild.v1.BuildOptions.MachineType|null} [machineType] BuildOptions machineType - * @property {number|Long|null} [diskSizeGb] BuildOptions diskSizeGb - * @property {google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption|null} [substitutionOption] BuildOptions substitutionOption - * @property {boolean|null} [dynamicSubstitutions] BuildOptions dynamicSubstitutions - * @property {google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption|null} [logStreamingOption] BuildOptions logStreamingOption - * @property {string|null} [workerPool] BuildOptions workerPool - * @property {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption|null} [pool] BuildOptions pool - * @property {google.devtools.cloudbuild.v1.BuildOptions.LoggingMode|null} [logging] BuildOptions logging - * @property {Array.|null} [env] BuildOptions env - * @property {Array.|null} [secretEnv] BuildOptions secretEnv - * @property {Array.|null} [volumes] BuildOptions volumes - * @property {google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior|null} [defaultLogsBucketBehavior] BuildOptions defaultLogsBucketBehavior + * @interface IDeleteBuildTriggerRequest + * @property {string|null} [name] DeleteBuildTriggerRequest name + * @property {string|null} [projectId] DeleteBuildTriggerRequest projectId + * @property {string|null} [triggerId] DeleteBuildTriggerRequest triggerId */ /** - * Constructs a new BuildOptions. + * Constructs a new DeleteBuildTriggerRequest. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a BuildOptions. - * @implements IBuildOptions + * @classdesc Represents a DeleteBuildTriggerRequest. + * @implements IDeleteBuildTriggerRequest * @constructor - * @param {google.devtools.cloudbuild.v1.IBuildOptions=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest=} [properties] Properties to set */ - function BuildOptions(properties) { - this.sourceProvenanceHash = []; - this.env = []; - this.secretEnv = []; - this.volumes = []; + function DeleteBuildTriggerRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17689,277 +18003,103 @@ } /** - * BuildOptions sourceProvenanceHash. - * @member {Array.} sourceProvenanceHash - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * DeleteBuildTriggerRequest name. + * @member {string} name + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @instance */ - BuildOptions.prototype.sourceProvenanceHash = $util.emptyArray; + DeleteBuildTriggerRequest.prototype.name = ""; /** - * BuildOptions requestedVerifyOption. - * @member {google.devtools.cloudbuild.v1.BuildOptions.VerifyOption} requestedVerifyOption - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * DeleteBuildTriggerRequest projectId. + * @member {string} projectId + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @instance */ - BuildOptions.prototype.requestedVerifyOption = 0; + DeleteBuildTriggerRequest.prototype.projectId = ""; /** - * BuildOptions machineType. - * @member {google.devtools.cloudbuild.v1.BuildOptions.MachineType} machineType - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * DeleteBuildTriggerRequest triggerId. + * @member {string} triggerId + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @instance */ - BuildOptions.prototype.machineType = 0; + DeleteBuildTriggerRequest.prototype.triggerId = ""; /** - * BuildOptions diskSizeGb. - * @member {number|Long} diskSizeGb - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance + * Creates a new DeleteBuildTriggerRequest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest instance */ - BuildOptions.prototype.diskSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DeleteBuildTriggerRequest.create = function create(properties) { + return new DeleteBuildTriggerRequest(properties); + }; /** - * BuildOptions substitutionOption. - * @member {google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption} substitutionOption - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance + * Encodes the specified DeleteBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest} message DeleteBuildTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - BuildOptions.prototype.substitutionOption = 0; + DeleteBuildTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; /** - * BuildOptions dynamicSubstitutions. - * @member {boolean} dynamicSubstitutions - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance + * Encodes the specified DeleteBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IDeleteBuildTriggerRequest} message DeleteBuildTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - BuildOptions.prototype.dynamicSubstitutions = false; + DeleteBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * BuildOptions logStreamingOption. - * @member {google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption} logStreamingOption - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.logStreamingOption = 0; - - /** - * BuildOptions workerPool. - * @member {string} workerPool - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.workerPool = ""; - - /** - * BuildOptions pool. - * @member {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption|null|undefined} pool - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.pool = null; - - /** - * BuildOptions logging. - * @member {google.devtools.cloudbuild.v1.BuildOptions.LoggingMode} logging - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.logging = 0; - - /** - * BuildOptions env. - * @member {Array.} env - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.env = $util.emptyArray; - - /** - * BuildOptions secretEnv. - * @member {Array.} secretEnv - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.secretEnv = $util.emptyArray; - - /** - * BuildOptions volumes. - * @member {Array.} volumes - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.volumes = $util.emptyArray; - - /** - * BuildOptions defaultLogsBucketBehavior. - * @member {google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior} defaultLogsBucketBehavior - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - */ - BuildOptions.prototype.defaultLogsBucketBehavior = 0; - - /** - * Creates a new BuildOptions instance using the specified properties. - * @function create - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @static - * @param {google.devtools.cloudbuild.v1.IBuildOptions=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions instance - */ - BuildOptions.create = function create(properties) { - return new BuildOptions(properties); - }; - - /** - * Encodes the specified BuildOptions message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.verify|verify} messages. - * @function encode - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @static - * @param {google.devtools.cloudbuild.v1.IBuildOptions} message BuildOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BuildOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sourceProvenanceHash != null && message.sourceProvenanceHash.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.sourceProvenanceHash.length; ++i) - writer.int32(message.sourceProvenanceHash[i]); - writer.ldelim(); - } - if (message.requestedVerifyOption != null && Object.hasOwnProperty.call(message, "requestedVerifyOption")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.requestedVerifyOption); - if (message.machineType != null && Object.hasOwnProperty.call(message, "machineType")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.machineType); - if (message.substitutionOption != null && Object.hasOwnProperty.call(message, "substitutionOption")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.substitutionOption); - if (message.logStreamingOption != null && Object.hasOwnProperty.call(message, "logStreamingOption")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.logStreamingOption); - if (message.diskSizeGb != null && Object.hasOwnProperty.call(message, "diskSizeGb")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.diskSizeGb); - if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.workerPool); - if (message.logging != null && Object.hasOwnProperty.call(message, "logging")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.logging); - if (message.env != null && message.env.length) - for (var i = 0; i < message.env.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.env[i]); - if (message.secretEnv != null && message.secretEnv.length) - for (var i = 0; i < message.secretEnv.length; ++i) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.secretEnv[i]); - if (message.volumes != null && message.volumes.length) - for (var i = 0; i < message.volumes.length; ++i) - $root.google.devtools.cloudbuild.v1.Volume.encode(message.volumes[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.dynamicSubstitutions != null && Object.hasOwnProperty.call(message, "dynamicSubstitutions")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.dynamicSubstitutions); - if (message.pool != null && Object.hasOwnProperty.call(message, "pool")) - $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.encode(message.pool, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); - if (message.defaultLogsBucketBehavior != null && Object.hasOwnProperty.call(message, "defaultLogsBucketBehavior")) - writer.uint32(/* id 21, wireType 0 =*/168).int32(message.defaultLogsBucketBehavior); - return writer; - }; - - /** - * Encodes the specified BuildOptions message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @static - * @param {google.devtools.cloudbuild.v1.IBuildOptions} message BuildOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BuildOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BuildOptions message from the specified reader or buffer. + * Decodes a DeleteBuildTriggerRequest message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BuildOptions.decode = function decode(reader, length) { + DeleteBuildTriggerRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - if (!(message.sourceProvenanceHash && message.sourceProvenanceHash.length)) - message.sourceProvenanceHash = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.sourceProvenanceHash.push(reader.int32()); - } else - message.sourceProvenanceHash.push(reader.int32()); - break; - } - case 2: { - message.requestedVerifyOption = reader.int32(); - break; - } case 3: { - message.machineType = reader.int32(); - break; - } - case 6: { - message.diskSizeGb = reader.int64(); - break; - } - case 4: { - message.substitutionOption = reader.int32(); - break; - } - case 17: { - message.dynamicSubstitutions = reader.bool(); - break; - } - case 5: { - message.logStreamingOption = reader.int32(); - break; - } - case 7: { - message.workerPool = reader.string(); - break; - } - case 19: { - message.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.decode(reader, reader.uint32()); - break; - } - case 11: { - message.logging = reader.int32(); - break; - } - case 12: { - if (!(message.env && message.env.length)) - message.env = []; - message.env.push(reader.string()); - break; - } - case 13: { - if (!(message.secretEnv && message.secretEnv.length)) - message.secretEnv = []; - message.secretEnv.push(reader.string()); + message.name = reader.string(); break; } - case 14: { - if (!(message.volumes && message.volumes.length)) - message.volumes = []; - message.volumes.push($root.google.devtools.cloudbuild.v1.Volume.decode(reader, reader.uint32())); + case 1: { + message.projectId = reader.string(); break; } - case 21: { - message.defaultLogsBucketBehavior = reader.int32(); + case 2: { + message.triggerId = reader.string(); break; } default: @@ -17971,798 +18111,1972 @@ }; /** - * Decodes a BuildOptions message from the specified reader or buffer, length delimited. + * Decodes a DeleteBuildTriggerRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BuildOptions.decodeDelimited = function decodeDelimited(reader) { + DeleteBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BuildOptions message. + * Verifies a DeleteBuildTriggerRequest message. * @function verify - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BuildOptions.verify = function verify(message) { + DeleteBuildTriggerRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.sourceProvenanceHash != null && message.hasOwnProperty("sourceProvenanceHash")) { - if (!Array.isArray(message.sourceProvenanceHash)) - return "sourceProvenanceHash: array expected"; - for (var i = 0; i < message.sourceProvenanceHash.length; ++i) - switch (message.sourceProvenanceHash[i]) { - default: - return "sourceProvenanceHash: enum value[] expected"; - case 0: - case 1: - case 2: - case 4: - break; - } - } - if (message.requestedVerifyOption != null && message.hasOwnProperty("requestedVerifyOption")) - switch (message.requestedVerifyOption) { - default: - return "requestedVerifyOption: enum value expected"; - case 0: - case 1: - break; - } - if (message.machineType != null && message.hasOwnProperty("machineType")) - switch (message.machineType) { - default: - return "machineType: enum value expected"; - case 0: - case 1: - case 2: - case 5: - case 6: - case 7: - break; - } - if (message.diskSizeGb != null && message.hasOwnProperty("diskSizeGb")) - if (!$util.isInteger(message.diskSizeGb) && !(message.diskSizeGb && $util.isInteger(message.diskSizeGb.low) && $util.isInteger(message.diskSizeGb.high))) - return "diskSizeGb: integer|Long expected"; - if (message.substitutionOption != null && message.hasOwnProperty("substitutionOption")) - switch (message.substitutionOption) { - default: - return "substitutionOption: enum value expected"; - case 0: - case 1: - break; - } - if (message.dynamicSubstitutions != null && message.hasOwnProperty("dynamicSubstitutions")) - if (typeof message.dynamicSubstitutions !== "boolean") - return "dynamicSubstitutions: boolean expected"; - if (message.logStreamingOption != null && message.hasOwnProperty("logStreamingOption")) - switch (message.logStreamingOption) { - default: - return "logStreamingOption: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.workerPool != null && message.hasOwnProperty("workerPool")) - if (!$util.isString(message.workerPool)) - return "workerPool: string expected"; - if (message.pool != null && message.hasOwnProperty("pool")) { - var error = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify(message.pool); - if (error) - return "pool." + error; - } - if (message.logging != null && message.hasOwnProperty("logging")) - switch (message.logging) { - default: - return "logging: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 5: - case 4: - break; - } - if (message.env != null && message.hasOwnProperty("env")) { - if (!Array.isArray(message.env)) - return "env: array expected"; - for (var i = 0; i < message.env.length; ++i) - if (!$util.isString(message.env[i])) - return "env: string[] expected"; - } - if (message.secretEnv != null && message.hasOwnProperty("secretEnv")) { - if (!Array.isArray(message.secretEnv)) - return "secretEnv: array expected"; - for (var i = 0; i < message.secretEnv.length; ++i) - if (!$util.isString(message.secretEnv[i])) - return "secretEnv: string[] expected"; - } - if (message.volumes != null && message.hasOwnProperty("volumes")) { - if (!Array.isArray(message.volumes)) - return "volumes: array expected"; - for (var i = 0; i < message.volumes.length; ++i) { - var error = $root.google.devtools.cloudbuild.v1.Volume.verify(message.volumes[i]); - if (error) - return "volumes." + error; - } - } - if (message.defaultLogsBucketBehavior != null && message.hasOwnProperty("defaultLogsBucketBehavior")) - switch (message.defaultLogsBucketBehavior) { - default: - return "defaultLogsBucketBehavior: enum value expected"; - case 0: - case 1: - break; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + if (!$util.isString(message.triggerId)) + return "triggerId: string expected"; return null; }; /** - * Creates a BuildOptions message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + * @returns {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} DeleteBuildTriggerRequest */ - BuildOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.BuildOptions) + DeleteBuildTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest) return object; - var message = new $root.google.devtools.cloudbuild.v1.BuildOptions(); - if (object.sourceProvenanceHash) { - if (!Array.isArray(object.sourceProvenanceHash)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.sourceProvenanceHash: array expected"); - message.sourceProvenanceHash = []; - for (var i = 0; i < object.sourceProvenanceHash.length; ++i) - switch (object.sourceProvenanceHash[i]) { - default: - if (typeof object.sourceProvenanceHash[i] === "number") { - message.sourceProvenanceHash[i] = object.sourceProvenanceHash[i]; - break; - } - case "NONE": - case 0: - message.sourceProvenanceHash[i] = 0; - break; - case "SHA256": - case 1: - message.sourceProvenanceHash[i] = 1; - break; - case "MD5": - case 2: - message.sourceProvenanceHash[i] = 2; - break; - case "SHA512": - case 4: - message.sourceProvenanceHash[i] = 4; - break; - } - } - switch (object.requestedVerifyOption) { - default: - if (typeof object.requestedVerifyOption === "number") { - message.requestedVerifyOption = object.requestedVerifyOption; - break; - } - break; - case "NOT_VERIFIED": - case 0: - message.requestedVerifyOption = 0; - break; - case "VERIFIED": - case 1: - message.requestedVerifyOption = 1; - break; - } - switch (object.machineType) { - default: - if (typeof object.machineType === "number") { - message.machineType = object.machineType; - break; - } - break; - case "UNSPECIFIED": - case 0: - message.machineType = 0; - break; - case "N1_HIGHCPU_8": - case 1: - message.machineType = 1; - break; - case "N1_HIGHCPU_32": - case 2: - message.machineType = 2; - break; - case "E2_HIGHCPU_8": - case 5: - message.machineType = 5; - break; - case "E2_HIGHCPU_32": - case 6: - message.machineType = 6; - break; - case "E2_MEDIUM": - case 7: - message.machineType = 7; - break; + var message = new $root.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.triggerId != null) + message.triggerId = String(object.triggerId); + return message; + }; + + /** + * Creates a plain object from a DeleteBuildTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest} message DeleteBuildTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBuildTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.triggerId = ""; + object.name = ""; } - if (object.diskSizeGb != null) - if ($util.Long) - (message.diskSizeGb = $util.Long.fromValue(object.diskSizeGb)).unsigned = false; - else if (typeof object.diskSizeGb === "string") - message.diskSizeGb = parseInt(object.diskSizeGb, 10); - else if (typeof object.diskSizeGb === "number") - message.diskSizeGb = object.diskSizeGb; - else if (typeof object.diskSizeGb === "object") - message.diskSizeGb = new $util.LongBits(object.diskSizeGb.low >>> 0, object.diskSizeGb.high >>> 0).toNumber(); - switch (object.substitutionOption) { - default: - if (typeof object.substitutionOption === "number") { - message.substitutionOption = object.substitutionOption; - break; - } - break; - case "MUST_MATCH": - case 0: - message.substitutionOption = 0; - break; - case "ALLOW_LOOSE": - case 1: - message.substitutionOption = 1; - break; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + object.triggerId = message.triggerId; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBuildTriggerRequest to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBuildTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBuildTriggerRequest + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - if (object.dynamicSubstitutions != null) - message.dynamicSubstitutions = Boolean(object.dynamicSubstitutions); - switch (object.logStreamingOption) { - default: - if (typeof object.logStreamingOption === "number") { - message.logStreamingOption = object.logStreamingOption; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest"; + }; + + return DeleteBuildTriggerRequest; + })(); + + v1.UpdateBuildTriggerRequest = (function() { + + /** + * Properties of an UpdateBuildTriggerRequest. + * @memberof google.devtools.cloudbuild.v1 + * @interface IUpdateBuildTriggerRequest + * @property {string|null} [projectId] UpdateBuildTriggerRequest projectId + * @property {string|null} [triggerId] UpdateBuildTriggerRequest triggerId + * @property {google.devtools.cloudbuild.v1.IBuildTrigger|null} [trigger] UpdateBuildTriggerRequest trigger + */ + + /** + * Constructs a new UpdateBuildTriggerRequest. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents an UpdateBuildTriggerRequest. + * @implements IUpdateBuildTriggerRequest + * @constructor + * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest=} [properties] Properties to set + */ + function UpdateBuildTriggerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBuildTriggerRequest projectId. + * @member {string} projectId + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @instance + */ + UpdateBuildTriggerRequest.prototype.projectId = ""; + + /** + * UpdateBuildTriggerRequest triggerId. + * @member {string} triggerId + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @instance + */ + UpdateBuildTriggerRequest.prototype.triggerId = ""; + + /** + * UpdateBuildTriggerRequest trigger. + * @member {google.devtools.cloudbuild.v1.IBuildTrigger|null|undefined} trigger + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @instance + */ + UpdateBuildTriggerRequest.prototype.trigger = null; + + /** + * Creates a new UpdateBuildTriggerRequest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest instance + */ + UpdateBuildTriggerRequest.create = function create(properties) { + return new UpdateBuildTriggerRequest(properties); + }; + + /** + * Encodes the specified UpdateBuildTriggerRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest} message UpdateBuildTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBuildTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerId); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.devtools.cloudbuild.v1.BuildTrigger.encode(message.trigger, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBuildTriggerRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.IUpdateBuildTriggerRequest} message UpdateBuildTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBuildTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBuildTriggerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBuildTriggerRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.projectId = reader.string(); + break; + } + case 2: { + message.triggerId = reader.string(); + break; + } + case 3: { + message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); break; } - break; - case "STREAM_DEFAULT": - case 0: - message.logStreamingOption = 0; - break; - case "STREAM_ON": - case 1: - message.logStreamingOption = 1; - break; - case "STREAM_OFF": - case 2: - message.logStreamingOption = 2; - break; } - if (object.workerPool != null) - message.workerPool = String(object.workerPool); - if (object.pool != null) { - if (typeof object.pool !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.pool: object expected"); - message.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.fromObject(object.pool); + return message; + }; + + /** + * Decodes an UpdateBuildTriggerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBuildTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBuildTriggerRequest message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBuildTriggerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + if (!$util.isString(message.triggerId)) + return "triggerId: string expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.devtools.cloudbuild.v1.BuildTrigger.verify(message.trigger); + if (error) + return "trigger." + error; } - switch (object.logging) { - default: - if (typeof object.logging === "number") { - message.logging = object.logging; - break; - } - break; - case "LOGGING_UNSPECIFIED": - case 0: - message.logging = 0; - break; - case "LEGACY": - case 1: - message.logging = 1; - break; - case "GCS_ONLY": - case 2: - message.logging = 2; - break; - case "STACKDRIVER_ONLY": - case 3: - message.logging = 3; - break; - case "CLOUD_LOGGING_ONLY": - case 5: - message.logging = 5; - break; - case "NONE": - case 4: - message.logging = 4; - break; + return null; + }; + + /** + * Creates an UpdateBuildTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} UpdateBuildTriggerRequest + */ + UpdateBuildTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest) + return object; + var message = new $root.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest(); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.triggerId != null) + message.triggerId = String(object.triggerId); + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.trigger: object expected"); + message.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.fromObject(object.trigger); } - if (object.env) { - if (!Array.isArray(object.env)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.env: array expected"); - message.env = []; - for (var i = 0; i < object.env.length; ++i) - message.env[i] = String(object.env[i]); + return message; + }; + + /** + * Creates a plain object from an UpdateBuildTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest} message UpdateBuildTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBuildTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.triggerId = ""; + object.trigger = null; } - if (object.secretEnv) { - if (!Array.isArray(object.secretEnv)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.secretEnv: array expected"); - message.secretEnv = []; - for (var i = 0; i < object.secretEnv.length; ++i) - message.secretEnv[i] = String(object.secretEnv[i]); + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + object.triggerId = message.triggerId; + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.devtools.cloudbuild.v1.BuildTrigger.toObject(message.trigger, options); + return object; + }; + + /** + * Converts this UpdateBuildTriggerRequest to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBuildTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBuildTriggerRequest + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBuildTriggerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - if (object.volumes) { - if (!Array.isArray(object.volumes)) - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.volumes: array expected"); - message.volumes = []; - for (var i = 0; i < object.volumes.length; ++i) { - if (typeof object.volumes[i] !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.volumes: object expected"); - message.volumes[i] = $root.google.devtools.cloudbuild.v1.Volume.fromObject(object.volumes[i]); - } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest"; + }; + + return UpdateBuildTriggerRequest; + })(); + + v1.BuildOptions = (function() { + + /** + * Properties of a BuildOptions. + * @memberof google.devtools.cloudbuild.v1 + * @interface IBuildOptions + * @property {Array.|null} [sourceProvenanceHash] BuildOptions sourceProvenanceHash + * @property {google.devtools.cloudbuild.v1.BuildOptions.VerifyOption|null} [requestedVerifyOption] BuildOptions requestedVerifyOption + * @property {google.devtools.cloudbuild.v1.BuildOptions.MachineType|null} [machineType] BuildOptions machineType + * @property {number|Long|null} [diskSizeGb] BuildOptions diskSizeGb + * @property {google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption|null} [substitutionOption] BuildOptions substitutionOption + * @property {boolean|null} [dynamicSubstitutions] BuildOptions dynamicSubstitutions + * @property {google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption|null} [logStreamingOption] BuildOptions logStreamingOption + * @property {string|null} [workerPool] BuildOptions workerPool + * @property {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption|null} [pool] BuildOptions pool + * @property {google.devtools.cloudbuild.v1.BuildOptions.LoggingMode|null} [logging] BuildOptions logging + * @property {Array.|null} [env] BuildOptions env + * @property {Array.|null} [secretEnv] BuildOptions secretEnv + * @property {Array.|null} [volumes] BuildOptions volumes + * @property {google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior|null} [defaultLogsBucketBehavior] BuildOptions defaultLogsBucketBehavior + */ + + /** + * Constructs a new BuildOptions. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents a BuildOptions. + * @implements IBuildOptions + * @constructor + * @param {google.devtools.cloudbuild.v1.IBuildOptions=} [properties] Properties to set + */ + function BuildOptions(properties) { + this.sourceProvenanceHash = []; + this.env = []; + this.secretEnv = []; + this.volumes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BuildOptions sourceProvenanceHash. + * @member {Array.} sourceProvenanceHash + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.sourceProvenanceHash = $util.emptyArray; + + /** + * BuildOptions requestedVerifyOption. + * @member {google.devtools.cloudbuild.v1.BuildOptions.VerifyOption} requestedVerifyOption + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.requestedVerifyOption = 0; + + /** + * BuildOptions machineType. + * @member {google.devtools.cloudbuild.v1.BuildOptions.MachineType} machineType + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.machineType = 0; + + /** + * BuildOptions diskSizeGb. + * @member {number|Long} diskSizeGb + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.diskSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BuildOptions substitutionOption. + * @member {google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption} substitutionOption + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.substitutionOption = 0; + + /** + * BuildOptions dynamicSubstitutions. + * @member {boolean} dynamicSubstitutions + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.dynamicSubstitutions = false; + + /** + * BuildOptions logStreamingOption. + * @member {google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption} logStreamingOption + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.logStreamingOption = 0; + + /** + * BuildOptions workerPool. + * @member {string} workerPool + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.workerPool = ""; + + /** + * BuildOptions pool. + * @member {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption|null|undefined} pool + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.pool = null; + + /** + * BuildOptions logging. + * @member {google.devtools.cloudbuild.v1.BuildOptions.LoggingMode} logging + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.logging = 0; + + /** + * BuildOptions env. + * @member {Array.} env + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.env = $util.emptyArray; + + /** + * BuildOptions secretEnv. + * @member {Array.} secretEnv + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.secretEnv = $util.emptyArray; + + /** + * BuildOptions volumes. + * @member {Array.} volumes + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.volumes = $util.emptyArray; + + /** + * BuildOptions defaultLogsBucketBehavior. + * @member {google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior} defaultLogsBucketBehavior + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + */ + BuildOptions.prototype.defaultLogsBucketBehavior = 0; + + /** + * Creates a new BuildOptions instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {google.devtools.cloudbuild.v1.IBuildOptions=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions instance + */ + BuildOptions.create = function create(properties) { + return new BuildOptions(properties); + }; + + /** + * Encodes the specified BuildOptions message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {google.devtools.cloudbuild.v1.IBuildOptions} message BuildOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceProvenanceHash != null && message.sourceProvenanceHash.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.sourceProvenanceHash.length; ++i) + writer.int32(message.sourceProvenanceHash[i]); + writer.ldelim(); } - switch (object.defaultLogsBucketBehavior) { - default: + if (message.requestedVerifyOption != null && Object.hasOwnProperty.call(message, "requestedVerifyOption")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.requestedVerifyOption); + if (message.machineType != null && Object.hasOwnProperty.call(message, "machineType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.machineType); + if (message.substitutionOption != null && Object.hasOwnProperty.call(message, "substitutionOption")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.substitutionOption); + if (message.logStreamingOption != null && Object.hasOwnProperty.call(message, "logStreamingOption")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.logStreamingOption); + if (message.diskSizeGb != null && Object.hasOwnProperty.call(message, "diskSizeGb")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.diskSizeGb); + if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.workerPool); + if (message.logging != null && Object.hasOwnProperty.call(message, "logging")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.logging); + if (message.env != null && message.env.length) + for (var i = 0; i < message.env.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.env[i]); + if (message.secretEnv != null && message.secretEnv.length) + for (var i = 0; i < message.secretEnv.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.secretEnv[i]); + if (message.volumes != null && message.volumes.length) + for (var i = 0; i < message.volumes.length; ++i) + $root.google.devtools.cloudbuild.v1.Volume.encode(message.volumes[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.dynamicSubstitutions != null && Object.hasOwnProperty.call(message, "dynamicSubstitutions")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.dynamicSubstitutions); + if (message.pool != null && Object.hasOwnProperty.call(message, "pool")) + $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.encode(message.pool, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.defaultLogsBucketBehavior != null && Object.hasOwnProperty.call(message, "defaultLogsBucketBehavior")) + writer.uint32(/* id 21, wireType 0 =*/168).int32(message.defaultLogsBucketBehavior); + return writer; + }; + + /** + * Encodes the specified BuildOptions message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {google.devtools.cloudbuild.v1.IBuildOptions} message BuildOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BuildOptions message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.sourceProvenanceHash && message.sourceProvenanceHash.length)) + message.sourceProvenanceHash = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.sourceProvenanceHash.push(reader.int32()); + } else + message.sourceProvenanceHash.push(reader.int32()); + break; + } + case 2: { + message.requestedVerifyOption = reader.int32(); + break; + } + case 3: { + message.machineType = reader.int32(); + break; + } + case 6: { + message.diskSizeGb = reader.int64(); + break; + } + case 4: { + message.substitutionOption = reader.int32(); + break; + } + case 17: { + message.dynamicSubstitutions = reader.bool(); + break; + } + case 5: { + message.logStreamingOption = reader.int32(); + break; + } + case 7: { + message.workerPool = reader.string(); + break; + } + case 19: { + message.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.decode(reader, reader.uint32()); + break; + } + case 11: { + message.logging = reader.int32(); + break; + } + case 12: { + if (!(message.env && message.env.length)) + message.env = []; + message.env.push(reader.string()); + break; + } + case 13: { + if (!(message.secretEnv && message.secretEnv.length)) + message.secretEnv = []; + message.secretEnv.push(reader.string()); + break; + } + case 14: { + if (!(message.volumes && message.volumes.length)) + message.volumes = []; + message.volumes.push($root.google.devtools.cloudbuild.v1.Volume.decode(reader, reader.uint32())); + break; + } + case 21: { + message.defaultLogsBucketBehavior = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BuildOptions message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BuildOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceProvenanceHash != null && message.hasOwnProperty("sourceProvenanceHash")) { + if (!Array.isArray(message.sourceProvenanceHash)) + return "sourceProvenanceHash: array expected"; + for (var i = 0; i < message.sourceProvenanceHash.length; ++i) + switch (message.sourceProvenanceHash[i]) { + default: + return "sourceProvenanceHash: enum value[] expected"; + case 0: + case 1: + case 2: + case 4: + break; + } + } + if (message.requestedVerifyOption != null && message.hasOwnProperty("requestedVerifyOption")) + switch (message.requestedVerifyOption) { + default: + return "requestedVerifyOption: enum value expected"; + case 0: + case 1: + break; + } + if (message.machineType != null && message.hasOwnProperty("machineType")) + switch (message.machineType) { + default: + return "machineType: enum value expected"; + case 0: + case 1: + case 2: + case 5: + case 6: + case 7: + break; + } + if (message.diskSizeGb != null && message.hasOwnProperty("diskSizeGb")) + if (!$util.isInteger(message.diskSizeGb) && !(message.diskSizeGb && $util.isInteger(message.diskSizeGb.low) && $util.isInteger(message.diskSizeGb.high))) + return "diskSizeGb: integer|Long expected"; + if (message.substitutionOption != null && message.hasOwnProperty("substitutionOption")) + switch (message.substitutionOption) { + default: + return "substitutionOption: enum value expected"; + case 0: + case 1: + break; + } + if (message.dynamicSubstitutions != null && message.hasOwnProperty("dynamicSubstitutions")) + if (typeof message.dynamicSubstitutions !== "boolean") + return "dynamicSubstitutions: boolean expected"; + if (message.logStreamingOption != null && message.hasOwnProperty("logStreamingOption")) + switch (message.logStreamingOption) { + default: + return "logStreamingOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + if (!$util.isString(message.workerPool)) + return "workerPool: string expected"; + if (message.pool != null && message.hasOwnProperty("pool")) { + var error = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify(message.pool); + if (error) + return "pool." + error; + } + if (message.logging != null && message.hasOwnProperty("logging")) + switch (message.logging) { + default: + return "logging: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + case 4: + break; + } + if (message.env != null && message.hasOwnProperty("env")) { + if (!Array.isArray(message.env)) + return "env: array expected"; + for (var i = 0; i < message.env.length; ++i) + if (!$util.isString(message.env[i])) + return "env: string[] expected"; + } + if (message.secretEnv != null && message.hasOwnProperty("secretEnv")) { + if (!Array.isArray(message.secretEnv)) + return "secretEnv: array expected"; + for (var i = 0; i < message.secretEnv.length; ++i) + if (!$util.isString(message.secretEnv[i])) + return "secretEnv: string[] expected"; + } + if (message.volumes != null && message.hasOwnProperty("volumes")) { + if (!Array.isArray(message.volumes)) + return "volumes: array expected"; + for (var i = 0; i < message.volumes.length; ++i) { + var error = $root.google.devtools.cloudbuild.v1.Volume.verify(message.volumes[i]); + if (error) + return "volumes." + error; + } + } + if (message.defaultLogsBucketBehavior != null && message.hasOwnProperty("defaultLogsBucketBehavior")) + switch (message.defaultLogsBucketBehavior) { + default: + return "defaultLogsBucketBehavior: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a BuildOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.BuildOptions} BuildOptions + */ + BuildOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.BuildOptions) + return object; + var message = new $root.google.devtools.cloudbuild.v1.BuildOptions(); + if (object.sourceProvenanceHash) { + if (!Array.isArray(object.sourceProvenanceHash)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.sourceProvenanceHash: array expected"); + message.sourceProvenanceHash = []; + for (var i = 0; i < object.sourceProvenanceHash.length; ++i) + switch (object.sourceProvenanceHash[i]) { + default: + if (typeof object.sourceProvenanceHash[i] === "number") { + message.sourceProvenanceHash[i] = object.sourceProvenanceHash[i]; + break; + } + case "NONE": + case 0: + message.sourceProvenanceHash[i] = 0; + break; + case "SHA256": + case 1: + message.sourceProvenanceHash[i] = 1; + break; + case "MD5": + case 2: + message.sourceProvenanceHash[i] = 2; + break; + case "SHA512": + case 4: + message.sourceProvenanceHash[i] = 4; + break; + } + } + switch (object.requestedVerifyOption) { + default: + if (typeof object.requestedVerifyOption === "number") { + message.requestedVerifyOption = object.requestedVerifyOption; + break; + } + break; + case "NOT_VERIFIED": + case 0: + message.requestedVerifyOption = 0; + break; + case "VERIFIED": + case 1: + message.requestedVerifyOption = 1; + break; + } + switch (object.machineType) { + default: + if (typeof object.machineType === "number") { + message.machineType = object.machineType; + break; + } + break; + case "UNSPECIFIED": + case 0: + message.machineType = 0; + break; + case "N1_HIGHCPU_8": + case 1: + message.machineType = 1; + break; + case "N1_HIGHCPU_32": + case 2: + message.machineType = 2; + break; + case "E2_HIGHCPU_8": + case 5: + message.machineType = 5; + break; + case "E2_HIGHCPU_32": + case 6: + message.machineType = 6; + break; + case "E2_MEDIUM": + case 7: + message.machineType = 7; + break; + } + if (object.diskSizeGb != null) + if ($util.Long) + (message.diskSizeGb = $util.Long.fromValue(object.diskSizeGb)).unsigned = false; + else if (typeof object.diskSizeGb === "string") + message.diskSizeGb = parseInt(object.diskSizeGb, 10); + else if (typeof object.diskSizeGb === "number") + message.diskSizeGb = object.diskSizeGb; + else if (typeof object.diskSizeGb === "object") + message.diskSizeGb = new $util.LongBits(object.diskSizeGb.low >>> 0, object.diskSizeGb.high >>> 0).toNumber(); + switch (object.substitutionOption) { + default: + if (typeof object.substitutionOption === "number") { + message.substitutionOption = object.substitutionOption; + break; + } + break; + case "MUST_MATCH": + case 0: + message.substitutionOption = 0; + break; + case "ALLOW_LOOSE": + case 1: + message.substitutionOption = 1; + break; + } + if (object.dynamicSubstitutions != null) + message.dynamicSubstitutions = Boolean(object.dynamicSubstitutions); + switch (object.logStreamingOption) { + default: + if (typeof object.logStreamingOption === "number") { + message.logStreamingOption = object.logStreamingOption; + break; + } + break; + case "STREAM_DEFAULT": + case 0: + message.logStreamingOption = 0; + break; + case "STREAM_ON": + case 1: + message.logStreamingOption = 1; + break; + case "STREAM_OFF": + case 2: + message.logStreamingOption = 2; + break; + } + if (object.workerPool != null) + message.workerPool = String(object.workerPool); + if (object.pool != null) { + if (typeof object.pool !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.pool: object expected"); + message.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.fromObject(object.pool); + } + switch (object.logging) { + default: + if (typeof object.logging === "number") { + message.logging = object.logging; + break; + } + break; + case "LOGGING_UNSPECIFIED": + case 0: + message.logging = 0; + break; + case "LEGACY": + case 1: + message.logging = 1; + break; + case "GCS_ONLY": + case 2: + message.logging = 2; + break; + case "STACKDRIVER_ONLY": + case 3: + message.logging = 3; + break; + case "CLOUD_LOGGING_ONLY": + case 5: + message.logging = 5; + break; + case "NONE": + case 4: + message.logging = 4; + break; + } + if (object.env) { + if (!Array.isArray(object.env)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.env: array expected"); + message.env = []; + for (var i = 0; i < object.env.length; ++i) + message.env[i] = String(object.env[i]); + } + if (object.secretEnv) { + if (!Array.isArray(object.secretEnv)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.secretEnv: array expected"); + message.secretEnv = []; + for (var i = 0; i < object.secretEnv.length; ++i) + message.secretEnv[i] = String(object.secretEnv[i]); + } + if (object.volumes) { + if (!Array.isArray(object.volumes)) + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.volumes: array expected"); + message.volumes = []; + for (var i = 0; i < object.volumes.length; ++i) { + if (typeof object.volumes[i] !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.BuildOptions.volumes: object expected"); + message.volumes[i] = $root.google.devtools.cloudbuild.v1.Volume.fromObject(object.volumes[i]); + } + } + switch (object.defaultLogsBucketBehavior) { + default: if (typeof object.defaultLogsBucketBehavior === "number") { message.defaultLogsBucketBehavior = object.defaultLogsBucketBehavior; break; } - break; - case "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED": - case 0: - message.defaultLogsBucketBehavior = 0; - break; - case "REGIONAL_USER_OWNED_BUCKET": - case 1: - message.defaultLogsBucketBehavior = 1; - break; + break; + case "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED": + case 0: + message.defaultLogsBucketBehavior = 0; + break; + case "REGIONAL_USER_OWNED_BUCKET": + case 1: + message.defaultLogsBucketBehavior = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a BuildOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {google.devtools.cloudbuild.v1.BuildOptions} message BuildOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.sourceProvenanceHash = []; + object.env = []; + object.secretEnv = []; + object.volumes = []; + } + if (options.defaults) { + object.requestedVerifyOption = options.enums === String ? "NOT_VERIFIED" : 0; + object.machineType = options.enums === String ? "UNSPECIFIED" : 0; + object.substitutionOption = options.enums === String ? "MUST_MATCH" : 0; + object.logStreamingOption = options.enums === String ? "STREAM_DEFAULT" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.diskSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.diskSizeGb = options.longs === String ? "0" : 0; + object.workerPool = ""; + object.logging = options.enums === String ? "LOGGING_UNSPECIFIED" : 0; + object.dynamicSubstitutions = false; + object.pool = null; + object.defaultLogsBucketBehavior = options.enums === String ? "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" : 0; + } + if (message.sourceProvenanceHash && message.sourceProvenanceHash.length) { + object.sourceProvenanceHash = []; + for (var j = 0; j < message.sourceProvenanceHash.length; ++j) + object.sourceProvenanceHash[j] = options.enums === String ? $root.google.devtools.cloudbuild.v1.Hash.HashType[message.sourceProvenanceHash[j]] === undefined ? message.sourceProvenanceHash[j] : $root.google.devtools.cloudbuild.v1.Hash.HashType[message.sourceProvenanceHash[j]] : message.sourceProvenanceHash[j]; + } + if (message.requestedVerifyOption != null && message.hasOwnProperty("requestedVerifyOption")) + object.requestedVerifyOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.VerifyOption[message.requestedVerifyOption] === undefined ? message.requestedVerifyOption : $root.google.devtools.cloudbuild.v1.BuildOptions.VerifyOption[message.requestedVerifyOption] : message.requestedVerifyOption; + if (message.machineType != null && message.hasOwnProperty("machineType")) + object.machineType = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.MachineType[message.machineType] === undefined ? message.machineType : $root.google.devtools.cloudbuild.v1.BuildOptions.MachineType[message.machineType] : message.machineType; + if (message.substitutionOption != null && message.hasOwnProperty("substitutionOption")) + object.substitutionOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption[message.substitutionOption] === undefined ? message.substitutionOption : $root.google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption[message.substitutionOption] : message.substitutionOption; + if (message.logStreamingOption != null && message.hasOwnProperty("logStreamingOption")) + object.logStreamingOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption[message.logStreamingOption] === undefined ? message.logStreamingOption : $root.google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption[message.logStreamingOption] : message.logStreamingOption; + if (message.diskSizeGb != null && message.hasOwnProperty("diskSizeGb")) + if (typeof message.diskSizeGb === "number") + object.diskSizeGb = options.longs === String ? String(message.diskSizeGb) : message.diskSizeGb; + else + object.diskSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.diskSizeGb) : options.longs === Number ? new $util.LongBits(message.diskSizeGb.low >>> 0, message.diskSizeGb.high >>> 0).toNumber() : message.diskSizeGb; + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + object.workerPool = message.workerPool; + if (message.logging != null && message.hasOwnProperty("logging")) + object.logging = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.LoggingMode[message.logging] === undefined ? message.logging : $root.google.devtools.cloudbuild.v1.BuildOptions.LoggingMode[message.logging] : message.logging; + if (message.env && message.env.length) { + object.env = []; + for (var j = 0; j < message.env.length; ++j) + object.env[j] = message.env[j]; + } + if (message.secretEnv && message.secretEnv.length) { + object.secretEnv = []; + for (var j = 0; j < message.secretEnv.length; ++j) + object.secretEnv[j] = message.secretEnv[j]; + } + if (message.volumes && message.volumes.length) { + object.volumes = []; + for (var j = 0; j < message.volumes.length; ++j) + object.volumes[j] = $root.google.devtools.cloudbuild.v1.Volume.toObject(message.volumes[j], options); + } + if (message.dynamicSubstitutions != null && message.hasOwnProperty("dynamicSubstitutions")) + object.dynamicSubstitutions = message.dynamicSubstitutions; + if (message.pool != null && message.hasOwnProperty("pool")) + object.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.toObject(message.pool, options); + if (message.defaultLogsBucketBehavior != null && message.hasOwnProperty("defaultLogsBucketBehavior")) + object.defaultLogsBucketBehavior = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior[message.defaultLogsBucketBehavior] === undefined ? message.defaultLogsBucketBehavior : $root.google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior[message.defaultLogsBucketBehavior] : message.defaultLogsBucketBehavior; + return object; + }; + + /** + * Converts this BuildOptions to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @instance + * @returns {Object.} JSON object + */ + BuildOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BuildOptions + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BuildOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildOptions"; + }; + + /** + * VerifyOption enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.VerifyOption + * @enum {number} + * @property {number} NOT_VERIFIED=0 NOT_VERIFIED value + * @property {number} VERIFIED=1 VERIFIED value + */ + BuildOptions.VerifyOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NOT_VERIFIED"] = 0; + values[valuesById[1] = "VERIFIED"] = 1; + return values; + })(); + + /** + * MachineType enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.MachineType + * @enum {number} + * @property {number} UNSPECIFIED=0 UNSPECIFIED value + * @property {number} N1_HIGHCPU_8=1 N1_HIGHCPU_8 value + * @property {number} N1_HIGHCPU_32=2 N1_HIGHCPU_32 value + * @property {number} E2_HIGHCPU_8=5 E2_HIGHCPU_8 value + * @property {number} E2_HIGHCPU_32=6 E2_HIGHCPU_32 value + * @property {number} E2_MEDIUM=7 E2_MEDIUM value + */ + BuildOptions.MachineType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNSPECIFIED"] = 0; + values[valuesById[1] = "N1_HIGHCPU_8"] = 1; + values[valuesById[2] = "N1_HIGHCPU_32"] = 2; + values[valuesById[5] = "E2_HIGHCPU_8"] = 5; + values[valuesById[6] = "E2_HIGHCPU_32"] = 6; + values[valuesById[7] = "E2_MEDIUM"] = 7; + return values; + })(); + + /** + * SubstitutionOption enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption + * @enum {number} + * @property {number} MUST_MATCH=0 MUST_MATCH value + * @property {number} ALLOW_LOOSE=1 ALLOW_LOOSE value + */ + BuildOptions.SubstitutionOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MUST_MATCH"] = 0; + values[valuesById[1] = "ALLOW_LOOSE"] = 1; + return values; + })(); + + /** + * LogStreamingOption enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption + * @enum {number} + * @property {number} STREAM_DEFAULT=0 STREAM_DEFAULT value + * @property {number} STREAM_ON=1 STREAM_ON value + * @property {number} STREAM_OFF=2 STREAM_OFF value + */ + BuildOptions.LogStreamingOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STREAM_DEFAULT"] = 0; + values[valuesById[1] = "STREAM_ON"] = 1; + values[valuesById[2] = "STREAM_OFF"] = 2; + return values; + })(); + + BuildOptions.PoolOption = (function() { + + /** + * Properties of a PoolOption. + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @interface IPoolOption + * @property {string|null} [name] PoolOption name + */ + + /** + * Constructs a new PoolOption. + * @memberof google.devtools.cloudbuild.v1.BuildOptions + * @classdesc Represents a PoolOption. + * @implements IPoolOption + * @constructor + * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption=} [properties] Properties to set + */ + function PoolOption(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PoolOption name. + * @member {string} name + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @instance + */ + PoolOption.prototype.name = ""; + + /** + * Creates a new PoolOption instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption instance + */ + PoolOption.create = function create(properties) { + return new PoolOption(properties); + }; + + /** + * Encodes the specified PoolOption message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption} message PoolOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified PoolOption message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption} message PoolOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PoolOption message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PoolOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PoolOption message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PoolOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PoolOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption + */ + PoolOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption) + return object; + var message = new $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PoolOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} message PoolOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PoolOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PoolOption to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @instance + * @returns {Object.} JSON object + */ + PoolOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PoolOption + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PoolOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"; + }; + + return PoolOption; + })(); + + /** + * LoggingMode enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.LoggingMode + * @enum {number} + * @property {number} LOGGING_UNSPECIFIED=0 LOGGING_UNSPECIFIED value + * @property {number} LEGACY=1 LEGACY value + * @property {number} GCS_ONLY=2 GCS_ONLY value + * @property {number} STACKDRIVER_ONLY=3 STACKDRIVER_ONLY value + * @property {number} CLOUD_LOGGING_ONLY=5 CLOUD_LOGGING_ONLY value + * @property {number} NONE=4 NONE value + */ + BuildOptions.LoggingMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOGGING_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEGACY"] = 1; + values[valuesById[2] = "GCS_ONLY"] = 2; + values[valuesById[3] = "STACKDRIVER_ONLY"] = 3; + values[valuesById[5] = "CLOUD_LOGGING_ONLY"] = 5; + values[valuesById[4] = "NONE"] = 4; + return values; + })(); + + /** + * DefaultLogsBucketBehavior enum. + * @name google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior + * @enum {number} + * @property {number} DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED=0 DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED value + * @property {number} REGIONAL_USER_OWNED_BUCKET=1 REGIONAL_USER_OWNED_BUCKET value + */ + BuildOptions.DefaultLogsBucketBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "REGIONAL_USER_OWNED_BUCKET"] = 1; + return values; + })(); + + return BuildOptions; + })(); + + v1.ReceiveTriggerWebhookRequest = (function() { + + /** + * Properties of a ReceiveTriggerWebhookRequest. + * @memberof google.devtools.cloudbuild.v1 + * @interface IReceiveTriggerWebhookRequest + * @property {string|null} [name] ReceiveTriggerWebhookRequest name + * @property {google.api.IHttpBody|null} [body] ReceiveTriggerWebhookRequest body + * @property {string|null} [projectId] ReceiveTriggerWebhookRequest projectId + * @property {string|null} [trigger] ReceiveTriggerWebhookRequest trigger + * @property {string|null} [secret] ReceiveTriggerWebhookRequest secret + */ + + /** + * Constructs a new ReceiveTriggerWebhookRequest. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents a ReceiveTriggerWebhookRequest. + * @implements IReceiveTriggerWebhookRequest + * @constructor + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest=} [properties] Properties to set + */ + function ReceiveTriggerWebhookRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReceiveTriggerWebhookRequest name. + * @member {string} name + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + */ + ReceiveTriggerWebhookRequest.prototype.name = ""; + + /** + * ReceiveTriggerWebhookRequest body. + * @member {google.api.IHttpBody|null|undefined} body + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + */ + ReceiveTriggerWebhookRequest.prototype.body = null; + + /** + * ReceiveTriggerWebhookRequest projectId. + * @member {string} projectId + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + */ + ReceiveTriggerWebhookRequest.prototype.projectId = ""; + + /** + * ReceiveTriggerWebhookRequest trigger. + * @member {string} trigger + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + */ + ReceiveTriggerWebhookRequest.prototype.trigger = ""; + + /** + * ReceiveTriggerWebhookRequest secret. + * @member {string} secret + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + */ + ReceiveTriggerWebhookRequest.prototype.secret = ""; + + /** + * Creates a new ReceiveTriggerWebhookRequest instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest instance + */ + ReceiveTriggerWebhookRequest.create = function create(properties) { + return new ReceiveTriggerWebhookRequest(properties); + }; + + /** + * Encodes the specified ReceiveTriggerWebhookRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReceiveTriggerWebhookRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.api.HttpBody.encode(message.body, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.trigger); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.secret); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified ReceiveTriggerWebhookRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReceiveTriggerWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReceiveTriggerWebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReceiveTriggerWebhookRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 1: { + message.body = $root.google.api.HttpBody.decode(reader, reader.uint32()); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.trigger = reader.string(); + break; + } + case 4: { + message.secret = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } return message; }; /** - * Creates a plain object from a BuildOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * Decodes a ReceiveTriggerWebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest * @static - * @param {google.devtools.cloudbuild.v1.BuildOptions} message BuildOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BuildOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.sourceProvenanceHash = []; - object.env = []; - object.secretEnv = []; - object.volumes = []; - } - if (options.defaults) { - object.requestedVerifyOption = options.enums === String ? "NOT_VERIFIED" : 0; - object.machineType = options.enums === String ? "UNSPECIFIED" : 0; - object.substitutionOption = options.enums === String ? "MUST_MATCH" : 0; - object.logStreamingOption = options.enums === String ? "STREAM_DEFAULT" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.diskSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.diskSizeGb = options.longs === String ? "0" : 0; - object.workerPool = ""; - object.logging = options.enums === String ? "LOGGING_UNSPECIFIED" : 0; - object.dynamicSubstitutions = false; - object.pool = null; - object.defaultLogsBucketBehavior = options.enums === String ? "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED" : 0; - } - if (message.sourceProvenanceHash && message.sourceProvenanceHash.length) { - object.sourceProvenanceHash = []; - for (var j = 0; j < message.sourceProvenanceHash.length; ++j) - object.sourceProvenanceHash[j] = options.enums === String ? $root.google.devtools.cloudbuild.v1.Hash.HashType[message.sourceProvenanceHash[j]] === undefined ? message.sourceProvenanceHash[j] : $root.google.devtools.cloudbuild.v1.Hash.HashType[message.sourceProvenanceHash[j]] : message.sourceProvenanceHash[j]; - } - if (message.requestedVerifyOption != null && message.hasOwnProperty("requestedVerifyOption")) - object.requestedVerifyOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.VerifyOption[message.requestedVerifyOption] === undefined ? message.requestedVerifyOption : $root.google.devtools.cloudbuild.v1.BuildOptions.VerifyOption[message.requestedVerifyOption] : message.requestedVerifyOption; - if (message.machineType != null && message.hasOwnProperty("machineType")) - object.machineType = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.MachineType[message.machineType] === undefined ? message.machineType : $root.google.devtools.cloudbuild.v1.BuildOptions.MachineType[message.machineType] : message.machineType; - if (message.substitutionOption != null && message.hasOwnProperty("substitutionOption")) - object.substitutionOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption[message.substitutionOption] === undefined ? message.substitutionOption : $root.google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption[message.substitutionOption] : message.substitutionOption; - if (message.logStreamingOption != null && message.hasOwnProperty("logStreamingOption")) - object.logStreamingOption = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption[message.logStreamingOption] === undefined ? message.logStreamingOption : $root.google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption[message.logStreamingOption] : message.logStreamingOption; - if (message.diskSizeGb != null && message.hasOwnProperty("diskSizeGb")) - if (typeof message.diskSizeGb === "number") - object.diskSizeGb = options.longs === String ? String(message.diskSizeGb) : message.diskSizeGb; - else - object.diskSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.diskSizeGb) : options.longs === Number ? new $util.LongBits(message.diskSizeGb.low >>> 0, message.diskSizeGb.high >>> 0).toNumber() : message.diskSizeGb; - if (message.workerPool != null && message.hasOwnProperty("workerPool")) - object.workerPool = message.workerPool; - if (message.logging != null && message.hasOwnProperty("logging")) - object.logging = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.LoggingMode[message.logging] === undefined ? message.logging : $root.google.devtools.cloudbuild.v1.BuildOptions.LoggingMode[message.logging] : message.logging; - if (message.env && message.env.length) { - object.env = []; - for (var j = 0; j < message.env.length; ++j) - object.env[j] = message.env[j]; - } - if (message.secretEnv && message.secretEnv.length) { - object.secretEnv = []; - for (var j = 0; j < message.secretEnv.length; ++j) - object.secretEnv[j] = message.secretEnv[j]; - } - if (message.volumes && message.volumes.length) { - object.volumes = []; - for (var j = 0; j < message.volumes.length; ++j) - object.volumes[j] = $root.google.devtools.cloudbuild.v1.Volume.toObject(message.volumes[j], options); - } - if (message.dynamicSubstitutions != null && message.hasOwnProperty("dynamicSubstitutions")) - object.dynamicSubstitutions = message.dynamicSubstitutions; - if (message.pool != null && message.hasOwnProperty("pool")) - object.pool = $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption.toObject(message.pool, options); - if (message.defaultLogsBucketBehavior != null && message.hasOwnProperty("defaultLogsBucketBehavior")) - object.defaultLogsBucketBehavior = options.enums === String ? $root.google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior[message.defaultLogsBucketBehavior] === undefined ? message.defaultLogsBucketBehavior : $root.google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior[message.defaultLogsBucketBehavior] : message.defaultLogsBucketBehavior; - return object; + ReceiveTriggerWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Converts this BuildOptions to JSON. - * @function toJSON - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @instance - * @returns {Object.} JSON object + * Verifies a ReceiveTriggerWebhookRequest message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BuildOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + ReceiveTriggerWebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.api.HttpBody.verify(message.body); + if (error) + return "body." + error; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) + if (!$util.isString(message.trigger)) + return "trigger: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + return null; }; /** - * Gets the default type url for BuildOptions - * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.BuildOptions + * Creates a ReceiveTriggerWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest */ - BuildOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; + ReceiveTriggerWebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest) + return object; + var message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.body: object expected"); + message.body = $root.google.api.HttpBody.fromObject(object.body); } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildOptions"; + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.trigger != null) + message.trigger = String(object.trigger); + if (object.secret != null) + message.secret = String(object.secret); + return message; }; /** - * VerifyOption enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.VerifyOption - * @enum {number} - * @property {number} NOT_VERIFIED=0 NOT_VERIFIED value - * @property {number} VERIFIED=1 VERIFIED value - */ - BuildOptions.VerifyOption = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NOT_VERIFIED"] = 0; - values[valuesById[1] = "VERIFIED"] = 1; - return values; - })(); - - /** - * MachineType enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.MachineType - * @enum {number} - * @property {number} UNSPECIFIED=0 UNSPECIFIED value - * @property {number} N1_HIGHCPU_8=1 N1_HIGHCPU_8 value - * @property {number} N1_HIGHCPU_32=2 N1_HIGHCPU_32 value - * @property {number} E2_HIGHCPU_8=5 E2_HIGHCPU_8 value - * @property {number} E2_HIGHCPU_32=6 E2_HIGHCPU_32 value - * @property {number} E2_MEDIUM=7 E2_MEDIUM value - */ - BuildOptions.MachineType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNSPECIFIED"] = 0; - values[valuesById[1] = "N1_HIGHCPU_8"] = 1; - values[valuesById[2] = "N1_HIGHCPU_32"] = 2; - values[valuesById[5] = "E2_HIGHCPU_8"] = 5; - values[valuesById[6] = "E2_HIGHCPU_32"] = 6; - values[valuesById[7] = "E2_MEDIUM"] = 7; - return values; - })(); - - /** - * SubstitutionOption enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption - * @enum {number} - * @property {number} MUST_MATCH=0 MUST_MATCH value - * @property {number} ALLOW_LOOSE=1 ALLOW_LOOSE value + * Creates a plain object from a ReceiveTriggerWebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - BuildOptions.SubstitutionOption = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MUST_MATCH"] = 0; - values[valuesById[1] = "ALLOW_LOOSE"] = 1; - return values; - })(); + ReceiveTriggerWebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.body = null; + object.projectId = ""; + object.trigger = ""; + object.secret = ""; + object.name = ""; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.api.HttpBody.toObject(message.body, options); + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = message.trigger; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; /** - * LogStreamingOption enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption - * @enum {number} - * @property {number} STREAM_DEFAULT=0 STREAM_DEFAULT value - * @property {number} STREAM_ON=1 STREAM_ON value - * @property {number} STREAM_OFF=2 STREAM_OFF value + * Converts this ReceiveTriggerWebhookRequest to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @instance + * @returns {Object.} JSON object */ - BuildOptions.LogStreamingOption = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STREAM_DEFAULT"] = 0; - values[valuesById[1] = "STREAM_ON"] = 1; - values[valuesById[2] = "STREAM_OFF"] = 2; - return values; - })(); - - BuildOptions.PoolOption = (function() { - - /** - * Properties of a PoolOption. - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @interface IPoolOption - * @property {string|null} [name] PoolOption name - */ + ReceiveTriggerWebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new PoolOption. - * @memberof google.devtools.cloudbuild.v1.BuildOptions - * @classdesc Represents a PoolOption. - * @implements IPoolOption - * @constructor - * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption=} [properties] Properties to set - */ - function PoolOption(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Gets the default type url for ReceiveTriggerWebhookRequest + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReceiveTriggerWebhookRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"; + }; - /** - * PoolOption name. - * @member {string} name - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @instance - */ - PoolOption.prototype.name = ""; + return ReceiveTriggerWebhookRequest; + })(); - /** - * Creates a new PoolOption instance using the specified properties. - * @function create - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption instance - */ - PoolOption.create = function create(properties) { - return new PoolOption(properties); - }; + v1.ReceiveTriggerWebhookResponse = (function() { - /** - * Encodes the specified PoolOption message. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify|verify} messages. - * @function encode - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption} message PoolOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; + /** + * Properties of a ReceiveTriggerWebhookResponse. + * @memberof google.devtools.cloudbuild.v1 + * @interface IReceiveTriggerWebhookResponse + */ - /** - * Encodes the specified PoolOption message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.BuildOptions.PoolOption.verify|verify} messages. - * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {google.devtools.cloudbuild.v1.BuildOptions.IPoolOption} message PoolOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new ReceiveTriggerWebhookResponse. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents a ReceiveTriggerWebhookResponse. + * @implements IReceiveTriggerWebhookResponse + * @constructor + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse=} [properties] Properties to set + */ + function ReceiveTriggerWebhookResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes a PoolOption message from the specified reader or buffer. - * @function decode - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolOption.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new ReceiveTriggerWebhookResponse instance using the specified properties. + * @function create + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse instance + */ + ReceiveTriggerWebhookResponse.create = function create(properties) { + return new ReceiveTriggerWebhookResponse(properties); + }; - /** - * Decodes a PoolOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified ReceiveTriggerWebhookResponse message. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReceiveTriggerWebhookResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; - /** - * Verifies a PoolOption message. - * @function verify - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PoolOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; + /** + * Encodes the specified ReceiveTriggerWebhookResponse message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReceiveTriggerWebhookResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a PoolOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} PoolOption - */ - PoolOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption) - return object; - var message = new $root.google.devtools.cloudbuild.v1.BuildOptions.PoolOption(); - if (object.name != null) - message.name = String(object.name); - return message; - }; + /** + * Decodes a ReceiveTriggerWebhookResponse message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReceiveTriggerWebhookResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a plain object from a PoolOption message. Also converts values to other types if specified. - * @function toObject - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {google.devtools.cloudbuild.v1.BuildOptions.PoolOption} message PoolOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PoolOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; + /** + * Decodes a ReceiveTriggerWebhookResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReceiveTriggerWebhookResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this PoolOption to JSON. - * @function toJSON - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @instance - * @returns {Object.} JSON object - */ - PoolOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a ReceiveTriggerWebhookResponse message. + * @function verify + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReceiveTriggerWebhookResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; - /** - * Gets the default type url for PoolOption - * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.BuildOptions.PoolOption - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PoolOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.BuildOptions.PoolOption"; - }; + /** + * Creates a ReceiveTriggerWebhookResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + */ + ReceiveTriggerWebhookResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse) + return object; + return new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse(); + }; - return PoolOption; - })(); + /** + * Creates a plain object from a ReceiveTriggerWebhookResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReceiveTriggerWebhookResponse.toObject = function toObject() { + return {}; + }; /** - * LoggingMode enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.LoggingMode - * @enum {number} - * @property {number} LOGGING_UNSPECIFIED=0 LOGGING_UNSPECIFIED value - * @property {number} LEGACY=1 LEGACY value - * @property {number} GCS_ONLY=2 GCS_ONLY value - * @property {number} STACKDRIVER_ONLY=3 STACKDRIVER_ONLY value - * @property {number} CLOUD_LOGGING_ONLY=5 CLOUD_LOGGING_ONLY value - * @property {number} NONE=4 NONE value + * Converts this ReceiveTriggerWebhookResponse to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @instance + * @returns {Object.} JSON object */ - BuildOptions.LoggingMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LOGGING_UNSPECIFIED"] = 0; - values[valuesById[1] = "LEGACY"] = 1; - values[valuesById[2] = "GCS_ONLY"] = 2; - values[valuesById[3] = "STACKDRIVER_ONLY"] = 3; - values[valuesById[5] = "CLOUD_LOGGING_ONLY"] = 5; - values[valuesById[4] = "NONE"] = 4; - return values; - })(); + ReceiveTriggerWebhookResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * DefaultLogsBucketBehavior enum. - * @name google.devtools.cloudbuild.v1.BuildOptions.DefaultLogsBucketBehavior - * @enum {number} - * @property {number} DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED=0 DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED value - * @property {number} REGIONAL_USER_OWNED_BUCKET=1 REGIONAL_USER_OWNED_BUCKET value + * Gets the default type url for ReceiveTriggerWebhookResponse + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ - BuildOptions.DefaultLogsBucketBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DEFAULT_LOGS_BUCKET_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "REGIONAL_USER_OWNED_BUCKET"] = 1; - return values; - })(); + ReceiveTriggerWebhookResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"; + }; - return BuildOptions; + return ReceiveTriggerWebhookResponse; })(); - v1.ReceiveTriggerWebhookRequest = (function() { + v1.GitHubEnterpriseConfig = (function() { /** - * Properties of a ReceiveTriggerWebhookRequest. + * Properties of a GitHubEnterpriseConfig. * @memberof google.devtools.cloudbuild.v1 - * @interface IReceiveTriggerWebhookRequest - * @property {string|null} [name] ReceiveTriggerWebhookRequest name - * @property {google.api.IHttpBody|null} [body] ReceiveTriggerWebhookRequest body - * @property {string|null} [projectId] ReceiveTriggerWebhookRequest projectId - * @property {string|null} [trigger] ReceiveTriggerWebhookRequest trigger - * @property {string|null} [secret] ReceiveTriggerWebhookRequest secret + * @interface IGitHubEnterpriseConfig + * @property {string|null} [name] GitHubEnterpriseConfig name + * @property {string|null} [hostUrl] GitHubEnterpriseConfig hostUrl + * @property {number|Long|null} [appId] GitHubEnterpriseConfig appId + * @property {google.protobuf.ITimestamp|null} [createTime] GitHubEnterpriseConfig createTime + * @property {string|null} [webhookKey] GitHubEnterpriseConfig webhookKey + * @property {string|null} [peeredNetwork] GitHubEnterpriseConfig peeredNetwork + * @property {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets|null} [secrets] GitHubEnterpriseConfig secrets + * @property {string|null} [displayName] GitHubEnterpriseConfig displayName + * @property {string|null} [sslCa] GitHubEnterpriseConfig sslCa */ /** - * Constructs a new ReceiveTriggerWebhookRequest. + * Constructs a new GitHubEnterpriseConfig. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a ReceiveTriggerWebhookRequest. - * @implements IReceiveTriggerWebhookRequest + * @classdesc Represents a GitHubEnterpriseConfig. + * @implements IGitHubEnterpriseConfig * @constructor - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig=} [properties] Properties to set */ - function ReceiveTriggerWebhookRequest(properties) { + function GitHubEnterpriseConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18770,131 +20084,187 @@ } /** - * ReceiveTriggerWebhookRequest name. + * GitHubEnterpriseConfig name. * @member {string} name - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance */ - ReceiveTriggerWebhookRequest.prototype.name = ""; + GitHubEnterpriseConfig.prototype.name = ""; /** - * ReceiveTriggerWebhookRequest body. - * @member {google.api.IHttpBody|null|undefined} body - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * GitHubEnterpriseConfig hostUrl. + * @member {string} hostUrl + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance */ - ReceiveTriggerWebhookRequest.prototype.body = null; + GitHubEnterpriseConfig.prototype.hostUrl = ""; /** - * ReceiveTriggerWebhookRequest projectId. - * @member {string} projectId - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * GitHubEnterpriseConfig appId. + * @member {number|Long} appId + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance */ - ReceiveTriggerWebhookRequest.prototype.projectId = ""; + GitHubEnterpriseConfig.prototype.appId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * ReceiveTriggerWebhookRequest trigger. - * @member {string} trigger - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * GitHubEnterpriseConfig createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance */ - ReceiveTriggerWebhookRequest.prototype.trigger = ""; + GitHubEnterpriseConfig.prototype.createTime = null; /** - * ReceiveTriggerWebhookRequest secret. - * @member {string} secret - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * GitHubEnterpriseConfig webhookKey. + * @member {string} webhookKey + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance */ - ReceiveTriggerWebhookRequest.prototype.secret = ""; + GitHubEnterpriseConfig.prototype.webhookKey = ""; /** - * Creates a new ReceiveTriggerWebhookRequest instance using the specified properties. + * GitHubEnterpriseConfig peeredNetwork. + * @member {string} peeredNetwork + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig + * @instance + */ + GitHubEnterpriseConfig.prototype.peeredNetwork = ""; + + /** + * GitHubEnterpriseConfig secrets. + * @member {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets|null|undefined} secrets + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig + * @instance + */ + GitHubEnterpriseConfig.prototype.secrets = null; + + /** + * GitHubEnterpriseConfig displayName. + * @member {string} displayName + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig + * @instance + */ + GitHubEnterpriseConfig.prototype.displayName = ""; + + /** + * GitHubEnterpriseConfig sslCa. + * @member {string} sslCa + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig + * @instance + */ + GitHubEnterpriseConfig.prototype.sslCa = ""; + + /** + * Creates a new GitHubEnterpriseConfig instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest instance + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseConfig} GitHubEnterpriseConfig instance */ - ReceiveTriggerWebhookRequest.create = function create(properties) { - return new ReceiveTriggerWebhookRequest(properties); + GitHubEnterpriseConfig.create = function create(properties) { + return new GitHubEnterpriseConfig(properties); }; /** - * Encodes the specified ReceiveTriggerWebhookRequest message. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.verify|verify} messages. + * Encodes the specified GitHubEnterpriseConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig} message GitHubEnterpriseConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReceiveTriggerWebhookRequest.encode = function encode(message, writer) { + GitHubEnterpriseConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.api.HttpBody.encode(message.body, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); - if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.trigger); - if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.secret); + if (message.hostUrl != null && Object.hasOwnProperty.call(message, "hostUrl")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.hostUrl); + if (message.appId != null && Object.hasOwnProperty.call(message, "appId")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.appId); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); + if (message.webhookKey != null && Object.hasOwnProperty.call(message, "webhookKey")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.webhookKey); + if (message.peeredNetwork != null && Object.hasOwnProperty.call(message, "peeredNetwork")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.peeredNetwork); + if (message.secrets != null && Object.hasOwnProperty.call(message, "secrets")) + $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.encode(message.secrets, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.displayName); + if (message.sslCa != null && Object.hasOwnProperty.call(message, "sslCa")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.sslCa); return writer; }; /** - * Encodes the specified ReceiveTriggerWebhookRequest message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.verify|verify} messages. + * Encodes the specified GitHubEnterpriseConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseConfig} message GitHubEnterpriseConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReceiveTriggerWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + GitHubEnterpriseConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReceiveTriggerWebhookRequest message from the specified reader or buffer. + * Decodes a GitHubEnterpriseConfig message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseConfig} GitHubEnterpriseConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReceiveTriggerWebhookRequest.decode = function decode(reader, length) { + GitHubEnterpriseConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitHubEnterpriseConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: { + case 7: { message.name = reader.string(); break; } - case 1: { - message.body = $root.google.api.HttpBody.decode(reader, reader.uint32()); + case 3: { + message.hostUrl = reader.string(); break; } - case 2: { - message.projectId = reader.string(); + case 4: { + message.appId = reader.int64(); break; } - case 3: { - message.trigger = reader.string(); + case 6: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } - case 4: { - message.secret = reader.string(); + case 8: { + message.webhookKey = reader.string(); + break; + } + case 9: { + message.peeredNetwork = reader.string(); + break; + } + case 10: { + message.secrets = $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.decode(reader, reader.uint32()); + break; + } + case 11: { + message.displayName = reader.string(); + break; + } + case 12: { + message.sslCa = reader.string(); break; } default: @@ -18906,159 +20276,214 @@ }; /** - * Decodes a ReceiveTriggerWebhookRequest message from the specified reader or buffer, length delimited. + * Decodes a GitHubEnterpriseConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseConfig} GitHubEnterpriseConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReceiveTriggerWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + GitHubEnterpriseConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReceiveTriggerWebhookRequest message. + * Verifies a GitHubEnterpriseConfig message. * @function verify - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReceiveTriggerWebhookRequest.verify = function verify(message) { + GitHubEnterpriseConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.api.HttpBody.verify(message.body); + if (message.hostUrl != null && message.hasOwnProperty("hostUrl")) + if (!$util.isString(message.hostUrl)) + return "hostUrl: string expected"; + if (message.appId != null && message.hasOwnProperty("appId")) + if (!$util.isInteger(message.appId) && !(message.appId && $util.isInteger(message.appId.low) && $util.isInteger(message.appId.high))) + return "appId: integer|Long expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) - return "body." + error; + return "createTime." + error; } - if (message.projectId != null && message.hasOwnProperty("projectId")) - if (!$util.isString(message.projectId)) - return "projectId: string expected"; - if (message.trigger != null && message.hasOwnProperty("trigger")) - if (!$util.isString(message.trigger)) - return "trigger: string expected"; - if (message.secret != null && message.hasOwnProperty("secret")) - if (!$util.isString(message.secret)) - return "secret: string expected"; + if (message.webhookKey != null && message.hasOwnProperty("webhookKey")) + if (!$util.isString(message.webhookKey)) + return "webhookKey: string expected"; + if (message.peeredNetwork != null && message.hasOwnProperty("peeredNetwork")) + if (!$util.isString(message.peeredNetwork)) + return "peeredNetwork: string expected"; + if (message.secrets != null && message.hasOwnProperty("secrets")) { + var error = $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.verify(message.secrets); + if (error) + return "secrets." + error; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.sslCa != null && message.hasOwnProperty("sslCa")) + if (!$util.isString(message.sslCa)) + return "sslCa: string expected"; return null; }; /** - * Creates a ReceiveTriggerWebhookRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GitHubEnterpriseConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} ReceiveTriggerWebhookRequest + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseConfig} GitHubEnterpriseConfig */ - ReceiveTriggerWebhookRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest) + GitHubEnterpriseConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GitHubEnterpriseConfig) return object; - var message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest(); + var message = new $root.google.devtools.cloudbuild.v1.GitHubEnterpriseConfig(); if (object.name != null) message.name = String(object.name); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest.body: object expected"); - message.body = $root.google.api.HttpBody.fromObject(object.body); + if (object.hostUrl != null) + message.hostUrl = String(object.hostUrl); + if (object.appId != null) + if ($util.Long) + (message.appId = $util.Long.fromValue(object.appId)).unsigned = false; + else if (typeof object.appId === "string") + message.appId = parseInt(object.appId, 10); + else if (typeof object.appId === "number") + message.appId = object.appId; + else if (typeof object.appId === "object") + message.appId = new $util.LongBits(object.appId.low >>> 0, object.appId.high >>> 0).toNumber(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.projectId != null) - message.projectId = String(object.projectId); - if (object.trigger != null) - message.trigger = String(object.trigger); - if (object.secret != null) - message.secret = String(object.secret); + if (object.webhookKey != null) + message.webhookKey = String(object.webhookKey); + if (object.peeredNetwork != null) + message.peeredNetwork = String(object.peeredNetwork); + if (object.secrets != null) { + if (typeof object.secrets !== "object") + throw TypeError(".google.devtools.cloudbuild.v1.GitHubEnterpriseConfig.secrets: object expected"); + message.secrets = $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.fromObject(object.secrets); + } + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.sslCa != null) + message.sslCa = String(object.sslCa); return message; }; /** - * Creates a plain object from a ReceiveTriggerWebhookRequest message. Also converts values to other types if specified. + * Creates a plain object from a GitHubEnterpriseConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static - * @param {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest} message ReceiveTriggerWebhookRequest + * @param {google.devtools.cloudbuild.v1.GitHubEnterpriseConfig} message GitHubEnterpriseConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReceiveTriggerWebhookRequest.toObject = function toObject(message, options) { + GitHubEnterpriseConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.body = null; - object.projectId = ""; - object.trigger = ""; - object.secret = ""; + object.hostUrl = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.appId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.appId = options.longs === String ? "0" : 0; + object.createTime = null; object.name = ""; + object.webhookKey = ""; + object.peeredNetwork = ""; + object.secrets = null; + object.displayName = ""; + object.sslCa = ""; } - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.api.HttpBody.toObject(message.body, options); - if (message.projectId != null && message.hasOwnProperty("projectId")) - object.projectId = message.projectId; - if (message.trigger != null && message.hasOwnProperty("trigger")) - object.trigger = message.trigger; - if (message.secret != null && message.hasOwnProperty("secret")) - object.secret = message.secret; + if (message.hostUrl != null && message.hasOwnProperty("hostUrl")) + object.hostUrl = message.hostUrl; + if (message.appId != null && message.hasOwnProperty("appId")) + if (typeof message.appId === "number") + object.appId = options.longs === String ? String(message.appId) : message.appId; + else + object.appId = options.longs === String ? $util.Long.prototype.toString.call(message.appId) : options.longs === Number ? new $util.LongBits(message.appId.low >>> 0, message.appId.high >>> 0).toNumber() : message.appId; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.webhookKey != null && message.hasOwnProperty("webhookKey")) + object.webhookKey = message.webhookKey; + if (message.peeredNetwork != null && message.hasOwnProperty("peeredNetwork")) + object.peeredNetwork = message.peeredNetwork; + if (message.secrets != null && message.hasOwnProperty("secrets")) + object.secrets = $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.toObject(message.secrets, options); + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.sslCa != null && message.hasOwnProperty("sslCa")) + object.sslCa = message.sslCa; return object; }; /** - * Converts this ReceiveTriggerWebhookRequest to JSON. + * Converts this GitHubEnterpriseConfig to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @instance * @returns {Object.} JSON object */ - ReceiveTriggerWebhookRequest.prototype.toJSON = function toJSON() { + GitHubEnterpriseConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ReceiveTriggerWebhookRequest + * Gets the default type url for GitHubEnterpriseConfig * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ReceiveTriggerWebhookRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GitHubEnterpriseConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookRequest"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitHubEnterpriseConfig"; }; - return ReceiveTriggerWebhookRequest; + return GitHubEnterpriseConfig; })(); - v1.ReceiveTriggerWebhookResponse = (function() { + v1.GitHubEnterpriseSecrets = (function() { /** - * Properties of a ReceiveTriggerWebhookResponse. + * Properties of a GitHubEnterpriseSecrets. * @memberof google.devtools.cloudbuild.v1 - * @interface IReceiveTriggerWebhookResponse + * @interface IGitHubEnterpriseSecrets + * @property {string|null} [privateKeyVersionName] GitHubEnterpriseSecrets privateKeyVersionName + * @property {string|null} [webhookSecretVersionName] GitHubEnterpriseSecrets webhookSecretVersionName + * @property {string|null} [oauthSecretVersionName] GitHubEnterpriseSecrets oauthSecretVersionName + * @property {string|null} [oauthClientIdVersionName] GitHubEnterpriseSecrets oauthClientIdVersionName */ /** - * Constructs a new ReceiveTriggerWebhookResponse. + * Constructs a new GitHubEnterpriseSecrets. * @memberof google.devtools.cloudbuild.v1 - * @classdesc Represents a ReceiveTriggerWebhookResponse. - * @implements IReceiveTriggerWebhookResponse + * @classdesc Represents a GitHubEnterpriseSecrets. + * @implements IGitHubEnterpriseSecrets * @constructor - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse=} [properties] Properties to set + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets=} [properties] Properties to set */ - function ReceiveTriggerWebhookResponse(properties) { + function GitHubEnterpriseSecrets(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19066,63 +20491,119 @@ } /** - * Creates a new ReceiveTriggerWebhookResponse instance using the specified properties. + * GitHubEnterpriseSecrets privateKeyVersionName. + * @member {string} privateKeyVersionName + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets + * @instance + */ + GitHubEnterpriseSecrets.prototype.privateKeyVersionName = ""; + + /** + * GitHubEnterpriseSecrets webhookSecretVersionName. + * @member {string} webhookSecretVersionName + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets + * @instance + */ + GitHubEnterpriseSecrets.prototype.webhookSecretVersionName = ""; + + /** + * GitHubEnterpriseSecrets oauthSecretVersionName. + * @member {string} oauthSecretVersionName + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets + * @instance + */ + GitHubEnterpriseSecrets.prototype.oauthSecretVersionName = ""; + + /** + * GitHubEnterpriseSecrets oauthClientIdVersionName. + * @member {string} oauthClientIdVersionName + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets + * @instance + */ + GitHubEnterpriseSecrets.prototype.oauthClientIdVersionName = ""; + + /** + * Creates a new GitHubEnterpriseSecrets instance using the specified properties. * @function create - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse=} [properties] Properties to set - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse instance + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets=} [properties] Properties to set + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets} GitHubEnterpriseSecrets instance */ - ReceiveTriggerWebhookResponse.create = function create(properties) { - return new ReceiveTriggerWebhookResponse(properties); + GitHubEnterpriseSecrets.create = function create(properties) { + return new GitHubEnterpriseSecrets(properties); }; /** - * Encodes the specified ReceiveTriggerWebhookResponse message. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse.verify|verify} messages. + * Encodes the specified GitHubEnterpriseSecrets message. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.verify|verify} messages. * @function encode - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets} message GitHubEnterpriseSecrets message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReceiveTriggerWebhookResponse.encode = function encode(message, writer) { + GitHubEnterpriseSecrets.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.privateKeyVersionName != null && Object.hasOwnProperty.call(message, "privateKeyVersionName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.privateKeyVersionName); + if (message.webhookSecretVersionName != null && Object.hasOwnProperty.call(message, "webhookSecretVersionName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.webhookSecretVersionName); + if (message.oauthSecretVersionName != null && Object.hasOwnProperty.call(message, "oauthSecretVersionName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.oauthSecretVersionName); + if (message.oauthClientIdVersionName != null && Object.hasOwnProperty.call(message, "oauthClientIdVersionName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.oauthClientIdVersionName); return writer; }; /** - * Encodes the specified ReceiveTriggerWebhookResponse message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse.verify|verify} messages. + * Encodes the specified GitHubEnterpriseSecrets message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets.verify|verify} messages. * @function encodeDelimited - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static - * @param {google.devtools.cloudbuild.v1.IReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse message or plain object to encode + * @param {google.devtools.cloudbuild.v1.IGitHubEnterpriseSecrets} message GitHubEnterpriseSecrets message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReceiveTriggerWebhookResponse.encodeDelimited = function encodeDelimited(message, writer) { + GitHubEnterpriseSecrets.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReceiveTriggerWebhookResponse message from the specified reader or buffer. + * Decodes a GitHubEnterpriseSecrets message from the specified reader or buffer. * @function decode - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets} GitHubEnterpriseSecrets * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReceiveTriggerWebhookResponse.decode = function decode(reader, length) { + GitHubEnterpriseSecrets.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 5: { + message.privateKeyVersionName = reader.string(); + break; + } + case 6: { + message.webhookSecretVersionName = reader.string(); + break; + } + case 7: { + message.oauthSecretVersionName = reader.string(); + break; + } + case 8: { + message.oauthClientIdVersionName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19132,89 +20613,127 @@ }; /** - * Decodes a ReceiveTriggerWebhookResponse message from the specified reader or buffer, length delimited. + * Decodes a GitHubEnterpriseSecrets message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets} GitHubEnterpriseSecrets * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReceiveTriggerWebhookResponse.decodeDelimited = function decodeDelimited(reader) { + GitHubEnterpriseSecrets.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReceiveTriggerWebhookResponse message. + * Verifies a GitHubEnterpriseSecrets message. * @function verify - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReceiveTriggerWebhookResponse.verify = function verify(message) { + GitHubEnterpriseSecrets.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.privateKeyVersionName != null && message.hasOwnProperty("privateKeyVersionName")) + if (!$util.isString(message.privateKeyVersionName)) + return "privateKeyVersionName: string expected"; + if (message.webhookSecretVersionName != null && message.hasOwnProperty("webhookSecretVersionName")) + if (!$util.isString(message.webhookSecretVersionName)) + return "webhookSecretVersionName: string expected"; + if (message.oauthSecretVersionName != null && message.hasOwnProperty("oauthSecretVersionName")) + if (!$util.isString(message.oauthSecretVersionName)) + return "oauthSecretVersionName: string expected"; + if (message.oauthClientIdVersionName != null && message.hasOwnProperty("oauthClientIdVersionName")) + if (!$util.isString(message.oauthClientIdVersionName)) + return "oauthClientIdVersionName: string expected"; return null; }; /** - * Creates a ReceiveTriggerWebhookResponse message from a plain object. Also converts values to their respective internal types. + * Creates a GitHubEnterpriseSecrets message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static * @param {Object.} object Plain object - * @returns {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} ReceiveTriggerWebhookResponse + * @returns {google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets} GitHubEnterpriseSecrets */ - ReceiveTriggerWebhookResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse) + GitHubEnterpriseSecrets.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets) return object; - return new $root.google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse(); + var message = new $root.google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets(); + if (object.privateKeyVersionName != null) + message.privateKeyVersionName = String(object.privateKeyVersionName); + if (object.webhookSecretVersionName != null) + message.webhookSecretVersionName = String(object.webhookSecretVersionName); + if (object.oauthSecretVersionName != null) + message.oauthSecretVersionName = String(object.oauthSecretVersionName); + if (object.oauthClientIdVersionName != null) + message.oauthClientIdVersionName = String(object.oauthClientIdVersionName); + return message; }; /** - * Creates a plain object from a ReceiveTriggerWebhookResponse message. Also converts values to other types if specified. + * Creates a plain object from a GitHubEnterpriseSecrets message. Also converts values to other types if specified. * @function toObject - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static - * @param {google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse} message ReceiveTriggerWebhookResponse + * @param {google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets} message GitHubEnterpriseSecrets * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReceiveTriggerWebhookResponse.toObject = function toObject() { - return {}; + GitHubEnterpriseSecrets.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.privateKeyVersionName = ""; + object.webhookSecretVersionName = ""; + object.oauthSecretVersionName = ""; + object.oauthClientIdVersionName = ""; + } + if (message.privateKeyVersionName != null && message.hasOwnProperty("privateKeyVersionName")) + object.privateKeyVersionName = message.privateKeyVersionName; + if (message.webhookSecretVersionName != null && message.hasOwnProperty("webhookSecretVersionName")) + object.webhookSecretVersionName = message.webhookSecretVersionName; + if (message.oauthSecretVersionName != null && message.hasOwnProperty("oauthSecretVersionName")) + object.oauthSecretVersionName = message.oauthSecretVersionName; + if (message.oauthClientIdVersionName != null && message.hasOwnProperty("oauthClientIdVersionName")) + object.oauthClientIdVersionName = message.oauthClientIdVersionName; + return object; }; /** - * Converts this ReceiveTriggerWebhookResponse to JSON. + * Converts this GitHubEnterpriseSecrets to JSON. * @function toJSON - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @instance * @returns {Object.} JSON object */ - ReceiveTriggerWebhookResponse.prototype.toJSON = function toJSON() { + GitHubEnterpriseSecrets.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ReceiveTriggerWebhookResponse + * Gets the default type url for GitHubEnterpriseSecrets * @function getTypeUrl - * @memberof google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse + * @memberof google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ReceiveTriggerWebhookResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GitHubEnterpriseSecrets.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devtools.cloudbuild.v1.ReceiveTriggerWebhookResponse"; + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.GitHubEnterpriseSecrets"; }; - return ReceiveTriggerWebhookResponse; + return GitHubEnterpriseSecrets; })(); v1.WorkerPool = (function() { diff --git a/packages/google-devtools-cloudbuild/protos/protos.json b/packages/google-devtools-cloudbuild/protos/protos.json index 4993e7745d0..a99573dd6ee 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.json +++ b/packages/google-devtools-cloudbuild/protos/protos.json @@ -1778,6 +1778,105 @@ } } }, + "GitRepoSource": { + "oneofs": { + "source": { + "oneof": [ + "repository" + ] + }, + "enterpriseConfig": { + "oneof": [ + "githubEnterpriseConfig" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "repository": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Repository" + } + }, + "ref": { + "type": "string", + "id": 2 + }, + "repoType": { + "type": "GitFileSource.RepoType", + "id": 3 + }, + "githubEnterpriseConfig": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/GithubEnterpriseConfig" + } + } + } + }, + "GitFileSource": { + "oneofs": { + "source": { + "oneof": [ + "repository" + ] + }, + "enterpriseConfig": { + "oneof": [ + "githubEnterpriseConfig" + ] + } + }, + "fields": { + "path": { + "type": "string", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "repository": { + "type": "string", + "id": 7, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Repository" + } + }, + "repoType": { + "type": "RepoType", + "id": 3 + }, + "revision": { + "type": "string", + "id": 4 + }, + "githubEnterpriseConfig": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/GithubEnterpriseConfig" + } + } + }, + "nested": { + "RepoType": { + "values": { + "UNKNOWN": 0, + "CLOUD_SOURCE_REPOSITORIES": 1, + "GITHUB": 2, + "BITBUCKET_SERVER": 3, + "GITLAB": 4 + } + } + } + }, "BuildTrigger": { "options": { "(google.api.resource).type": "cloudbuild.googleapis.com/BuildTrigger", @@ -1790,7 +1889,8 @@ "oneof": [ "autodetect", "build", - "filename" + "filename", + "gitFileSource" ] } }, @@ -1847,6 +1947,10 @@ "type": "string", "id": 8 }, + "gitFileSource": { + "type": "GitFileSource", + "id": 24 + }, "createTime": { "type": "google.protobuf.Timestamp", "id": 5, @@ -1880,6 +1984,10 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "sourceToBuild": { + "type": "GitRepoSource", + "id": 26 + }, "serviceAccount": { "type": "string", "id": 33, @@ -2403,6 +2511,98 @@ "ReceiveTriggerWebhookResponse": { "fields": {} }, + "GitHubEnterpriseConfig": { + "options": { + "(google.api.resource).type": "cloudbuild.googleapis.com/GithubEnterpriseConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}" + }, + "fields": { + "name": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hostUrl": { + "type": "string", + "id": 3 + }, + "appId": { + "type": "int64", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "webhookKey": { + "type": "string", + "id": 8 + }, + "peeredNetwork": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "compute.googleapis.com/Network" + } + }, + "secrets": { + "type": "GitHubEnterpriseSecrets", + "id": 10 + }, + "displayName": { + "type": "string", + "id": 11 + }, + "sslCa": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GitHubEnterpriseSecrets": { + "fields": { + "privateKeyVersionName": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "secretmanager.googleapis.com/SecretVersion" + } + }, + "webhookSecretVersionName": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "secretmanager.googleapis.com/SecretVersion" + } + }, + "oauthSecretVersionName": { + "type": "string", + "id": 7, + "options": { + "(google.api.resource_reference).type": "secretmanager.googleapis.com/SecretVersion" + } + }, + "oauthClientIdVersionName": { + "type": "string", + "id": 8, + "options": { + "(google.api.resource_reference).type": "secretmanager.googleapis.com/SecretVersion" + } + } + } + }, "WorkerPool": { "options": { "(google.api.resource).type": "cloudbuild.googleapis.com/WorkerPool", diff --git a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts index 52a868e7ba4..5d2713fdf4c 100644 --- a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts +++ b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts @@ -194,15 +194,24 @@ export class CloudBuildClient { locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), projectBuildPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/builds/{build}' ), + projectConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/githubEnterpriseConfigs/{config}' + ), projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/builds/{build}' ), + projectLocationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}' + ), projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/triggers/{trigger}' ), @@ -3398,6 +3407,42 @@ export class CloudBuildClient { return this.pathTemplates.locationPathTemplate.match(locationName).location; } + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project: string, network: string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + /** * Return a fully-qualified project resource name string. * @@ -3459,6 +3504,44 @@ export class CloudBuildClient { .build; } + /** + * Return a fully-qualified projectConfig resource name string. + * + * @param {string} project + * @param {string} config + * @returns {string} Resource name string. + */ + projectConfigPath(project: string, config: string) { + return this.pathTemplates.projectConfigPathTemplate.render({ + project: project, + config: config, + }); + } + + /** + * Parse the project from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName) + .project; + } + + /** + * Parse the config from ProjectConfig resource. + * + * @param {string} projectConfigName + * A fully-qualified path representing project_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectConfigName(projectConfigName: string) { + return this.pathTemplates.projectConfigPathTemplate.match(projectConfigName) + .config; + } + /** * Return a fully-qualified projectLocationBuild resource name string. * @@ -3514,6 +3597,63 @@ export class CloudBuildClient { ).build; } + /** + * Return a fully-qualified projectLocationConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} config + * @returns {string} Resource name string. + */ + projectLocationConfigPath(project: string, location: string, config: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.render({ + project: project, + location: location, + config: config, + }); + } + + /** + * Parse the project from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match( + projectLocationConfigName + ).project; + } + + /** + * Parse the location from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConfigName( + projectLocationConfigName: string + ) { + return this.pathTemplates.projectLocationConfigPathTemplate.match( + projectLocationConfigName + ).location; + } + + /** + * Parse the config from ProjectLocationConfig resource. + * + * @param {string} projectLocationConfigName + * A fully-qualified path representing project_location_config resource. + * @returns {string} A string representing the config. + */ + matchConfigFromProjectLocationConfigName(projectLocationConfigName: string) { + return this.pathTemplates.projectLocationConfigPathTemplate.match( + projectLocationConfigName + ).config; + } + /** * Return a fully-qualified projectLocationTrigger resource name string. * diff --git a/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts b/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts index 1342a9cf416..af884b6faf7 100644 --- a/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts +++ b/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts @@ -3561,6 +3561,55 @@ describe('v1.CloudBuildClient', () => { }); }); + describe('network', () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = { @@ -3648,6 +3697,55 @@ describe('v1.CloudBuildClient', () => { }); }); + describe('projectConfig', () => { + const fakePath = '/rendered/path/projectConfig'; + const expectedParameters = { + project: 'projectValue', + config: 'configValue', + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConfigPath', () => { + const result = client.projectConfigPath('projectValue', 'configValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConfigName', () => { + const result = client.matchProjectFromProjectConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConfigFromProjectConfigName', () => { + const result = client.matchConfigFromProjectConfigName(fakePath); + assert.strictEqual(result, 'configValue'); + assert( + (client.pathTemplates.projectConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationBuild', () => { const fakePath = '/rendered/path/projectLocationBuild'; const expectedParameters = { @@ -3726,6 +3824,85 @@ describe('v1.CloudBuildClient', () => { }); }); + describe('projectLocationConfig', () => { + const fakePath = '/rendered/path/projectLocationConfig'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + config: 'configValue', + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConfigPath', () => { + const result = client.projectLocationConfigPath( + 'projectValue', + 'locationValue', + 'configValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConfigName', () => { + const result = + client.matchProjectFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConfigName', () => { + const result = + client.matchLocationFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConfigFromProjectLocationConfigName', () => { + const result = + client.matchConfigFromProjectLocationConfigName(fakePath); + assert.strictEqual(result, 'configValue'); + assert( + ( + client.pathTemplates.projectLocationConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('projectLocationTrigger', () => { const fakePath = '/rendered/path/projectLocationTrigger'; const expectedParameters = {