From c0301872e36c6df8d90f9a5e7474baa2dff0b9f9 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 27 Jun 2023 20:04:30 +0000 Subject: [PATCH 1/2] feat: add repositoryevent to buildtrigger PiperOrigin-RevId: 543799743 Source-Link: https://github.com/googleapis/googleapis/commit/7972185b093d7548229f3206077cddf6a0b74b87 Source-Link: https://github.com/googleapis/googleapis-gen/commit/137bb0372575a66c3b1ae70a615c0679efb10b4c Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNsb3VkYnVpbGQvLk93bEJvdC55YW1sIiwiaCI6IjEzN2JiMDM3MjU3NWE2NmMzYjFhZTcwYTYxNWMwNjc5ZWZiMTBiNGMifQ== --- .../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 | 2402 +++++++++++ .../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 | 76 + .../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 | 2960 +++++++++++++ .../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 | 3709 +++++++++++++++++ .../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 | 676 +++ ...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 + ...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 | 611 +++ .../v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 165 + .../v2/src/v2/index.ts | 19 + .../v2/src/v2/repository_manager_client.ts | 2529 +++++++++++ .../v2/repository_manager_client_config.json | 102 + .../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 | 3276 +++++++++++++++ .../v2/tsconfig.json | 19 + .../v2/webpack.config.js | 64 + 78 files changed, 20917 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_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..bcefce6b603 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto @@ -0,0 +1,2402 @@ +// 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/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: "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.method_signature) = "project_id,build"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Returns information about a previously requested build. + // + // The `Build` that is returned includes its status (such as `SUCCESS`, + // `FAILURE`, or `WORKING`), and timing information. + rpc GetBuild(GetBuildRequest) returns (Build) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds/{id}" + additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Lists previously requested builds. + // + // Previously requested builds may still be in-progress, or may have finished + // successfully or unsuccessfully. + rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/builds" + additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } + }; + option (google.api.method_signature) = "project_id,filter"; + } + + // Cancels a build in progress. + rpc CancelBuild(CancelBuildRequest) returns (Build) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:cancel" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,id"; + } + + // Creates a new build based on the specified build. + // + // This method creates a new build using the original build request, which may + // or may not result in an identical build. + // + // For triggered builds: + // + // * Triggered builds resolve to a precise revision; therefore a retry of a + // triggered build will result in a build that uses the same revision. + // + // For non-triggered builds that specify `RepoSource`: + // + // * If the original build built from the tip of a branch, the retried build + // will build from the tip of that branch, which may not be the same revision + // as the original build. + // * If the original build specified a commit sha or revision ID, the retried + // build will use the identical source. + // + // For builds that specify `StorageSource`: + // + // * If the original build pulled source from Google Cloud Storage without + // specifying the generation of the object, the new build will use the current + // object, which may be different from the original build source. + // * If the original build pulled source from Cloud Storage and specified the + // generation of the object, the new build will attempt to use the same + // object, which may or may not be available depending on the bucket's + // lifecycle management settings. + rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/builds/{id}:retry" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:retry" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,id"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Approves or rejects a pending build. + // + // If approved, the returned LRO will be analogous to the LRO returned from + // a CreateBuild call. + // + // If rejected, the returned LRO will be immediately done. + rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/builds/*}:approve" + body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/builds/*}:approve" + body: "*" + } + }; + option (google.api.method_signature) = "name,approval_result"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // Creates a new `BuildTrigger`. + // + // This API is experimental. + rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers" + body: "trigger" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*}/triggers" + body: "trigger" + } + }; + option (google.api.method_signature) = "project_id,trigger"; + } + + // Returns information about a `BuildTrigger`. + // + // This API is experimental. + rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Lists existing `BuildTrigger`s. + // + // This API is experimental. + rpc ListBuildTriggers(ListBuildTriggersRequest) + returns (ListBuildTriggersResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/triggers" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*}/triggers" + } + }; + option (google.api.method_signature) = "project_id"; + } + + // Deletes a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/projects/{project_id}/triggers/{trigger_id}" + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/triggers/*}" + } + }; + option (google.api.method_signature) = "project_id,trigger_id"; + } + + // Updates a `BuildTrigger` by its project ID and trigger ID. + // + // This API is experimental. + rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { + option (google.api.http) = { + patch: "/v1/projects/{project_id}/triggers/{trigger_id}" + body: "trigger" + additional_bindings { + patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" + body: "trigger" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,trigger"; + } + + // Runs a `BuildTrigger` at a particular source revision. + rpc RunBuildTrigger(RunBuildTriggerRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" + body: "source" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:run" + body: "*" + } + }; + option (google.api.method_signature) = "project_id,trigger_id,source"; + option (google.longrunning.operation_info) = { + response_type: "Build" + metadata_type: "BuildOperationMetadata" + }; + } + + // ReceiveTriggerWebhook [Experimental] is called when the API receives a + // webhook request targeted at a specific trigger. + rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) + returns (ReceiveTriggerWebhookResponse) { + option (google.api.http) = { + post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" + body: "body" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" + body: "body" + } + }; + } + + // Creates a `WorkerPool`. + rpc CreateWorkerPool(CreateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/workerPools" + body: "worker_pool" + }; + option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "CreateWorkerPoolOperationMetadata" + }; + } + + // Returns details of a `WorkerPool`. + rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a `WorkerPool`. + rpc DeleteWorkerPool(DeleteWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/workerPools/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteWorkerPoolOperationMetadata" + }; + } + + // Updates a `WorkerPool`. + rpc UpdateWorkerPool(UpdateWorkerPoolRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" + body: "worker_pool" + }; + option (google.api.method_signature) = "worker_pool,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "WorkerPool" + metadata_type: "UpdateWorkerPoolOperationMetadata" + }; + } + + // Lists `WorkerPool`s. + rpc ListWorkerPools(ListWorkerPoolsRequest) + returns (ListWorkerPoolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/workerPools" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Specifies a build to retry. +message RetryBuildRequest { + // The name of the `Build` to retry. + // Format: `projects/{project}/locations/{location}/builds/{build}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Build ID of the original build. + string id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Specifies a build trigger to run and the source to use. +message RunBuildTriggerRequest { + // The name of the `Trigger` to run. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 4 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the trigger. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Source to build against this trigger. + RepoSource source = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in 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 Google Cloud Storage. +// This feature is in Preview; see description +// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). +message StorageSourceManifest { + // Google Cloud Storage bucket containing the source manifest (see [Bucket + // Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source manifest. + // + // This object must be a JSON file. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a supported storage service. +message Source { + // Location of source. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 2; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 3; + + // If provided, get the source from this Git repository. + GitSource git_source = 5; + + // If provided, get the source from this manifest in Google Cloud Storage. + // This feature is in Preview; see description + // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). + StorageSourceManifest storage_source_manifest = 8; + } +} + +// An image built by the pipeline. +message BuiltImage { + // Name used to push the container image to Google Container Registry, as + // presented to `docker push`. + string name = 1; + + // Docker Registry 2.0 digest. + string digest = 3; + + // Output only. Stores timing information for pushing the specified image. + TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// 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 Google Cloud Storage bucket, with the + // generation number. For example, + // `gs://mybucket/path/to/output.jar#generation`. + string location = 1; + + // The file hash of the artifact. + repeated FileHashes file_hash = 2; +} + +// A build resource in the Cloud Build API. +// +// At a high level, a `Build` describes where to find source code, how to build +// it (for example, the builder image to run on the source), and where to store +// the built artifacts. +// +// Fields can include the following variables, which will be expanded when the +// build is created: +// +// - $PROJECT_ID: the project ID of the build. +// - $PROJECT_NUMBER: the project number of the build. +// - $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; + + // Google Cloud Storage bucket where logs should be written (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. + string logs_bucket = 19; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 21 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The ID of the `BuildTrigger` that triggered this build, if it + // was triggered automatically. + string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Special options for this build. + BuildOptions options = 23; + + // Output only. URL to logs for this build in Google Cloud Console. + string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Substitutions data for `Build` resource. + map substitutions = 29; + + // Tags for annotation of a `Build`. These are not docker tags. + repeated string tags = 31; + + // Secrets to decrypt using Cloud Key Management Service. + // Note: Secret Manager is the recommended technique + // for managing sensitive data with Cloud Build. Use `available_secrets` to + // configure builds to access secrets from Secret Manager. For instructions, + // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets + repeated Secret secrets = 32; + + // Output only. Stores timing information for phases of the build. Valid keys + // are: + // + // * BUILD: time to execute all build steps. + // * PUSH: time to push all 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]; +} + +// Configuration for an automated build in response to source repository +// changes. +message BuildTrigger { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + plural: "triggers" + singular: "trigger" + pattern: "projects/{project}/triggers/{trigger}" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + }; + + // The `Trigger` name with format: + // `projects/{project}/locations/{location}/triggers/{trigger}`, where + // {trigger} is a unique identifier generated by the service. + string resource_name = 34; + + // Output only. Unique identifier of the trigger. + string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Human-readable description of this trigger. + string description = 10; + + // User-assigned name of the trigger. Must be unique within the project. + // Trigger names must meet the following requirements: + // + // + They must contain only alphanumeric characters and dashes. + // + They can be 1-64 characters long. + // + They must begin and end with an alphanumeric character. + string name = 21; + + // Tags for annotation of a `BuildTrigger` + repeated string tags = 19; + + // Template describing the types of source changes to trigger a build. + // + // Branch and tag names in trigger templates are interpreted as regular + // expressions. Any branch or tag change that matches that regular expression + // will trigger a build. + // + // Mutually exclusive with `github`. + RepoSource trigger_template = 7; + + // GitHubEventsConfig describes the configuration of a trigger that creates + // a build whenever a GitHub event is received. + // + // Mutually exclusive with `trigger_template`. + GitHubEventsConfig github = 13; + + // PubsubConfig describes the configuration of a trigger that + // creates a build whenever a Pub/Sub message is published. + PubsubConfig pubsub_config = 29; + + // WebhookConfig describes the configuration of a trigger that + // creates a build whenever a webhook is sent to a trigger's webhook URL. + WebhookConfig webhook_config = 31; + + // Template describing the Build request to make when the trigger is matched. + oneof build_template { + // Autodetect build configuration. The following precedence is used (case + // insensitive): + // + // 1. cloudbuild.yaml + // 2. cloudbuild.yml + // 3. cloudbuild.json + // 4. Dockerfile + // + // Currently only available for GitHub App Triggers. + bool autodetect = 18; + + // Contents of the build template. + Build build = 4; + + // Path, from the source root, to the build configuration file + // (i.e. cloudbuild.yaml). + string filename = 8; + } + + // Output only. Time when the trigger was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If true, the trigger will never automatically execute a build. + bool disabled = 9; + + // Substitutions for Build resource. The keys must match the following + // regular expression: `^_[A-Z0-9_]+$`. + map substitutions = 11; + + // ignored_files and included_files are file glob matches using + // https://golang.org/pkg/path/filepath/#Match extended with support for "**". + // + // If ignored_files and changed files are both empty, then they are + // not used to determine whether or not to trigger a build. + // + // If ignored_files is not empty, then we ignore any files that match + // any of the ignored_file globs. If the change has no files that are + // outside of the ignored_files globs, then we do not trigger a build. + repeated string ignored_files = 15; + + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is empty, then as far as this filter is + // concerned, we should trigger the build. + // + // If any of the files altered in the commit pass the ignored_files + // filter and included_files is not empty, then we make sure that at + // least one of those files matches a included_files glob. If not, + // then we do not trigger a build. + repeated string included_files = 16; + + // Optional. A Common Expression Language string. + string filter = 30 [(google.api.field_behavior) = OPTIONAL]; + + // The service account used for all user-controlled operations including + // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. + // If no service account is set, then the standard Cloud Build service account + // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. + // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` + string service_account = 33 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // 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. +// +// This message is experimental. +message GitHubEventsConfig { + // The installationID that emits the GitHub event. + int64 installation_id = 1 [deprecated = true]; + + // Owner of the repository. For example: The owner for + // https://github.com/googlecloudplatform/cloud-builders is + // "googlecloudplatform". + string owner = 6; + + // Name of the repository. For example: The name for + // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". + string name = 7; + + // Filter describing the types of events to trigger a build. + // Currently supported event types: push, pull_request. + oneof event { + // filter to match changes in pull requests. + PullRequestFilter pull_request = 4; + + // filter to match changes in refs like branches, tags. + PushFilter push = 5; + } +} + +// PubsubConfig describes the configuration of a trigger that +// creates a build whenever a Pub/Sub message is published. +message PubsubConfig { + // Enumerates potential issues with the underlying Pub/Sub subscription + // configuration. + enum State { + // The subscription configuration has not been checked. + STATE_UNSPECIFIED = 0; + + // The Pub/Sub subscription is properly configured. + OK = 1; + + // The subscription has been deleted. + SUBSCRIPTION_DELETED = 2; + + // The topic has been deleted. + TOPIC_DELETED = 3; + + // Some of the subscription's field are misconfigured. + SUBSCRIPTION_MISCONFIGURED = 4; + } + + // Output only. Name of the subscription. Format is + // `projects/{project}/subscriptions/{subscription}`. + string subscription = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Subscription" + } + ]; + + // The name of the topic from which this subscription is receiving messages. + // Format is `projects/{project}/topics/{topic}`. + string topic = 2 [ + (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } + ]; + + // Service account that will make the push request. + string service_account_email = 3 [(google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + }]; + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// WebhookConfig describes the configuration of a trigger that +// creates a build whenever a webhook is sent to a trigger's webhook URL. +message WebhookConfig { + // Enumerates potential issues with the Secret Manager secret provided by the + // user. + enum State { + // The webhook auth configuration not been checked. + STATE_UNSPECIFIED = 0; + + // The auth configuration is properly setup. + OK = 1; + + // The secret provided in auth_method has been deleted. + SECRET_DELETED = 2; + } + + // Auth method specifies how the webhook authenticates with GCP. + oneof auth_method { + // Required. Resource name for the secret required as a URL parameter. + string secret = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + } + + // Potential issues with the underlying Pub/Sub subscription configuration. + // Only populated on get requests. + State state = 4; +} + +// PullRequestFilter contains filter properties for matching GitHub Pull +// Requests. +message PullRequestFilter { + // Controls behavior of Pull Request comments. + enum CommentControl { + // Do not require comments on Pull Requests before builds are triggered. + COMMENTS_DISABLED = 0; + + // Enforce that repository owners or collaborators must comment on Pull + // Requests before builds are triggered. + COMMENTS_ENABLED = 1; + + // Enforce that repository owners or collaborators must comment on external + // contributors' Pull Requests before builds are triggered. + COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; + } + + // Target refs to match. + // A target ref is the git reference where the pull request will be applied. + oneof git_ref { + // Regex of branches to match. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch = 2; + } + + // Configure builds to run whether a repository owner or collaborator need to + // comment `/gcbrun`. + CommentControl comment_control = 5; + + // If true, branches that do NOT match the git_ref will trigger a build. + bool invert_regex = 6; +} + +// Push contains filter properties for matching GitHub git pushes. +message PushFilter { + // Modified refs to match. + // A modified refs are the refs modified by a git push operation. + oneof git_ref { + // Regexes matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch = 2; + + // Regexes matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag = 3; + } + + // When true, only trigger a build if the revision regex does NOT match the + // git_ref regex. + bool invert_regex = 4; +} + +// Request to create a new `BuildTrigger`. +message CreateBuildTriggerRequest { + // The parent resource where this trigger will be created. + // Format: `projects/{project}/locations/{location}` + string parent = 3 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to configure automatic builds. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to create. + BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Returns the `BuildTrigger` with the specified ID. +message GetBuildTriggerRequest { + // The name of the `Trigger` to retrieve. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list existing `BuildTriggers`. +message ListBuildTriggersRequest { + // The parent of the collection of `Triggers`. + // Format: `projects/{project}/locations/{location}` + string parent = 4 [(google.api.resource_reference) = { + child_type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project for which to list BuildTriggers. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Number of results to return in the list. + int32 page_size = 2; + + // Token to provide to skip to a particular spot in the list. + string page_token = 3; +} + +// Response containing existing `BuildTriggers`. +message ListBuildTriggersResponse { + // `BuildTriggers` for the project, sorted by `create_time` descending. + repeated BuildTrigger triggers = 1; + + // Token to receive the next page of results. + string next_page_token = 2; +} + +// Request to delete a `BuildTrigger`. +message DeleteBuildTriggerRequest { + // The name of the `Trigger` to delete. + // Format: `projects/{project}/locations/{location}/triggers/{trigger}` + string name = 3 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/BuildTrigger" + }]; + + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to delete. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to update an existing `BuildTrigger`. +message UpdateBuildTriggerRequest { + // Required. ID of the project that owns the trigger. + string project_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the `BuildTrigger` to update. + string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. `BuildTrigger` to update. + BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Optional arguments to enable specific features of builds. +message BuildOptions { + // Details about how a build should be executed on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + message PoolOption { + // The `WorkerPool` resource to execute the build on. + // You must have `cloudbuild.workerpools.use` on the project hosting the + // WorkerPool. + // + // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} + string name = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + } + + // Specifies the manner in which the build should be verified, if at all. + enum VerifyOption { + // Not a verifiable build (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; + } + + // Specifies the behavior when there is an error in the substitution checks. + enum SubstitutionOption { + // Fails the build if error in substitutions checks, like missing + // a substitution in the template or in the map. + MUST_MATCH = 0; + + // Do not fail the build if error in substitutions checks. + ALLOW_LOOSE = 1; + } + + // Specifies the behavior when writing build logs to Google Cloud Storage. + enum LogStreamingOption { + // Service may automatically determine build log streaming behavior. + STREAM_DEFAULT = 0; + + // Build logs should be streamed to Google Cloud Storage. + STREAM_ON = 1; + + // Build logs should not be streamed to Google Cloud Storage; they will be + // written when the build is completed. + STREAM_OFF = 2; + } + + // Specifies the logging mode. + enum LoggingMode { + // The service determines the logging mode. The default is `LEGACY`. Do not + // rely on the default logging behavior as it may change in the future. + LOGGING_UNSPECIFIED = 0; + + // 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 Google Cloud + // Storage. + LogStreamingOption log_streaming_option = 5; + + // This field deprecated; please use `pool.name` instead. + string worker_pool = 7 [deprecated = true]; + + // Optional. Specification for execution on a `WorkerPool`. + // + // See [running builds in a private + // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) + // for more information. + PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Option to specify the logging mode, which determines if and where build + // logs are stored. + LoggingMode logging = 11; + + // A list of global environment variable definitions that will exist for all + // build steps in this build. If a variable is defined in both globally and in + // a build step, the variable will use the build step value. + // + // The elements are of the form "KEY=VALUE" for the environment variable "KEY" + // being given the value "VALUE". + repeated string env = 12; + + // A list of global environment variables, which are encrypted using a Cloud + // Key Management Service crypto key. These values must be specified in the + // build's `Secret`. These variables will be available to all build steps + // in this build. + repeated string secret_env = 13; + + // Global list of volumes to mount for ALL build steps + // + // Each volume is created as an empty volume prior to starting the build + // process. Upon completion of the build, volumes and their contents are + // discarded. Global volume names and paths cannot conflict with the volumes + // defined a build step. + // + // Using a global volume in a build with only one step is not valid as + // it is indicative of a build request with an incorrect configuration. + repeated Volume volumes = 14; + + // 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 {} + +// Configuration for a `WorkerPool`. +// +// Cloud Build owns and maintains a pool of workers for general use and have no +// access to a project's private network. By default, builds submitted to +// Cloud Build will use a worker from this pool. +// +// If your build needs access to resources on a private network, +// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give +// your builds access to any single VPC network that you +// administer, including any on-prem resources connected to that VPC +// network. For an overview of private pools, see +// [Private pools +// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). +message WorkerPool { + option (google.api.resource) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" + plural: "workerPools" + singular: "workerPool" + style: DECLARATIVE_FRIENDLY + }; + + // State of the `WorkerPool`. + enum State { + // State of the `WorkerPool` is unknown. + STATE_UNSPECIFIED = 0; + + // `WorkerPool` is being created. + CREATING = 1; + + // `WorkerPool` is running. + RUNNING = 2; + + // `WorkerPool` is being deleted: cancelling builds and draining workers. + DELETING = 3; + + // `WorkerPool` is deleted. + DELETED = 4; + } + + // Output only. The resource name of the `WorkerPool`, with format + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + // The value of `{worker_pool}` is provided by `worker_pool_id` in + // `CreateWorkerPool` request and the value of `{location}` is determined by + // the endpoint accessed. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-specified, human-readable name for the `WorkerPool`. If provided, + // this value must be 1-63 characters. + string display_name = 2; + + // Output only. A unique identifier for the `WorkerPool`. + string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User specified annotations. See https://google.aip.dev/128#annotations + // for more details such as format and size limitations. + map annotations = 4; + + // Output only. Time at which the request to create the `WorkerPool` was + // received. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to update the `WorkerPool` was + // received. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time at which the request to delete the `WorkerPool` was + // received. + google.protobuf.Timestamp delete_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. `WorkerPool` state. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // 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 this is provided, it must match the server's etag on the + // workerpool for the request to be processed. + string etag = 2; + + // If set to true, and the `WorkerPool` is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 3; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to update a `WorkerPool`. +message UpdateWorkerPoolRequest { + // Required. The `WorkerPool` to update. + // + // The `name` field is used to identify the `WorkerPool` to update. + // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. + WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; + + // A mask specifying which fields in `worker_pool` to update. + google.protobuf.FieldMask update_mask = 2; + + // If set, validate the request and preview the response, but do not actually + // post it. + bool validate_only = 4; +} + +// Request to list `WorkerPool`s. +message ListWorkerPoolsRequest { + // Required. The parent of the collection of `WorkerPools`. + // Format: `projects/{project}/locations/{location}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of `WorkerPool`s to return. The service may return + // fewer than this value. If omitted, the server will use a sensible default. + int32 page_size = 2; + + // A page token, received from a previous `ListWorkerPools` call. Provide this + // to retrieve the subsequent page. + string page_token = 3; +} + +// Response containing existing `WorkerPools`. +message ListWorkerPoolsResponse { + // `WorkerPools` for the specified project. + repeated WorkerPool worker_pools = 1; + + // Continuation token used to page through large result sets. Provide this + // value in a subsequent ListWorkerPoolsRequest to return the next page of + // results. + string next_page_token = 2; +} + +// Metadata for the `CreateWorkerPool` operation. +message CreateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` to create. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `UpdateWorkerPool` operation. +message UpdateWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being updated. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} + +// Metadata for the `DeleteWorkerPool` operation. +message DeleteWorkerPoolOperationMetadata { + // The resource name of the `WorkerPool` being deleted. + // Format: + // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. + string worker_pool = 1 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // Time the operation was created. + google.protobuf.Timestamp create_time = 2; + + // Time the operation was completed. + google.protobuf.Timestamp complete_time = 3; +} diff --git a/owl-bot-staging/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..6cc8670f518 --- /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 this is provided, it must match the server's etag on the + * workerpool for the request to be processed. + */ + // const etag = 'abc123' + /** + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + */ + // const allowMissing = true + /** + * If set, validate the request and preview the response, but do not actually + * post it. + */ + // const validateOnly = true + + // Imports the Cloudbuild library + const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; + + // Instantiates a client + const cloudbuildClient = new CloudBuildClient(); + + async function callDeleteWorkerPool() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await cloudbuildClient.deleteWorkerPool(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteWorkerPool(); + // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/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..c458a03276f --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.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, 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. + */ + // 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..055af432bce --- /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 Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", + "canonical": true, + "file": "cloud_build.retry_build.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 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.", + "canonical": true, + "file": "cloud_build.run_build_trigger.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "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..8d54e73aea8 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts @@ -0,0 +1,2960 @@ +// 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}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/builds/{build}' + ), + projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + projectTriggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/triggers/{trigger}' + ), + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'id': request.id ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBuild(request, options, callback); + } +/** + * Cancels a build in progress. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to cancel. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. ID of the build. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'id': request.id ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.cancelBuild(request, options, callback); + } +/** + * Creates a new `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this trigger will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to configure automatic builds. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBuildTrigger(request, options, callback); + } +/** + * Returns information about a `BuildTrigger`. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'trigger_id': request.triggerId ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBuildTrigger(request, options, callback); + } +/** + * Deletes a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to delete. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'trigger_id': request.triggerId ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBuildTrigger(request, options, callback); + } +/** + * Updates a `BuildTrigger` by its project ID and trigger ID. + * + * This API is experimental. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.projectId + * Required. ID of the project that owns the trigger. + * @param {string} request.triggerId + * Required. ID of the `BuildTrigger` to update. + * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger + * Required. `BuildTrigger` to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'trigger_id': request.triggerId ?? '', + 'trigger.resource_name': request.trigger!.resourceName ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateBuildTrigger(request, options, callback); + } +/** + * ReceiveTriggerWebhook [Experimental] is called when the API receives a + * webhook request targeted at a specific trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `ReceiveTriggerWebhook` to retrieve. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {google.api.HttpBody} request.body + * HTTP request body. + * @param {string} request.projectId + * Project in which the specified trigger lives + * @param {string} request.trigger + * Name of the trigger to run the payload against + * @param {string} request.secret + * Secret token used for authorization if an OAuth token isn't provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getWorkerPool(request, options, callback); + } + +/** + * Starts a build with the specified configuration. + * + * This method returns a long-running `Operation`, which includes the build + * ID. Pass the build ID to `GetBuild` to determine the build status (such as + * `SUCCESS` or `FAILURE`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource where this build will be created. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {google.devtools.cloudbuild.v1.Build} request.build + * Required. Build resource to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBuild( + request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async + */ + async checkCreateBuildProgress(name: string): Promise>{ + const request = new 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 Google Cloud Storage without + * specifying the generation of the object, the new build will use the current + * object, which may be different from the original build source. + * * If the original build pulled source from Cloud Storage and specified the + * generation of the object, the new build will attempt to use the same + * object, which may or may not be available depending on the bucket's + * lifecycle management settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Build` to retry. + * Format: `projects/{project}/locations/{location}/builds/{build}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.id + * Required. Build ID of the original build. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + retryBuild( + request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'id': request.id ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.retryBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `retryBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.retry_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async + */ + async checkRetryBuildProgress(name: string): Promise>{ + const request = new 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.approveBuild(request, options, callback); + } +/** + * Check the status of the long running operation returned by `approveBuild()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.approve_build.js + * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async + */ + async checkApproveBuildProgress(name: string): Promise>{ + const request = new 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the `Trigger` to run. + * Format: `projects/{project}/locations/{location}/triggers/{trigger}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {string} request.triggerId + * Required. ID of the trigger. + * @param {google.devtools.cloudbuild.v1.RepoSource} request.source + * Source to build against this trigger. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runBuildTrigger( + request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'trigger_id': request.triggerId ?? '', + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.runBuildTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runBuildTrigger()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.run_build_trigger.js + * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async + */ + async checkRunBuildTriggerProgress(name: string): Promise>{ + const request = new 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.create_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async + */ + async checkCreateWorkerPoolProgress(name: string): Promise>{ + const request = new 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 this is provided, it must match the server's etag on the + * workerpool for the request to be processed. + * @param {boolean} request.allowMissing + * If set to true, and the `WorkerPool` is not found, the request will succeed + * but no action will be taken on the server. + * @param {boolean} request.validateOnly + * If set, validate the request and preview the response, but do not actually + * post it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteWorkerPool( + request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async + */ + async checkDeleteWorkerPoolProgress(name: string): Promise>{ + const request = new 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'worker_pool.name': request.workerPool!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateWorkerPool(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateWorkerPool()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_build.update_worker_pool.js + * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async + */ + async checkUpdateWorkerPoolProgress(name: string): Promise>{ + const request = new 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBuilds(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Builds`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * The page token for the next page of Builds. + * + * If unspecified, the first page of results is returned. + * + * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. + * In this case, the token should be discarded, and pagination should be + * restarted from the first page of results. + * + * See https://google.aip.dev/158 for more. + * @param {string} request.filter + * The raw filter text to constrain the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.createStream( + this.innerApiCalls.listBuilds as 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuilds']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuilds.asyncIterate( + this.innerApiCalls['listBuilds'] as GaxCall, + request as {}, + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBuildTriggers(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent of the collection of `Triggers`. + * Format: `projects/{project}/locations/{location}` + * @param {string} request.projectId + * Required. ID of the project for which to list BuildTriggers. + * @param {number} request.pageSize + * Number of results to return in the list. + * @param {string} request.pageToken + * Token to provide to skip to a particular spot in the list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.createStream( + this.innerApiCalls.listBuildTriggers as 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'project_id': request.projectId ?? '', + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBuildTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuildTriggers.asyncIterate( + this.innerApiCalls['listBuildTriggers'] as GaxCall, + request as {}, + 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listWorkerPools(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent of the collection of `WorkerPools`. + * Format: `projects/{project}/locations/{location}`. + * @param {number} request.pageSize + * The maximum number of `WorkerPool`s to return. The service may return + * fewer than this value. If omitted, the server will use a sensible default. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkerPools` call. Provide this + * to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.createStream( + this.innerApiCalls.listWorkerPools as 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 || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkerPools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listWorkerPools.asyncIterate( + this.innerApiCalls['listWorkerPools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} keyring + * @param {string} key + * @returns {string} Resource name string. + */ + cryptoKeyPath(project:string,location:string,keyring:string,key:string) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + keyring: keyring, + key: key, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + } + + /** + * Parse the keyring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the keyring. + */ + matchKeyringFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; + } + + /** + * Parse the key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key. + */ + matchKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectBuild resource name string. + * + * @param {string} project + * @param {string} build + * @returns {string} Resource name string. + */ + projectBuildPath(project:string,build:string) { + return this.pathTemplates.projectBuildPathTemplate.render({ + project: project, + build: build, + }); + } + + /** + * Parse the project from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; + } + + /** + * Parse the build from ProjectBuild resource. + * + * @param {string} projectBuildName + * A fully-qualified path representing project_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectBuildName(projectBuildName: string) { + return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; + } + + /** + * Return a fully-qualified projectLocationBuild resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + projectLocationBuildPath(project:string,location:string,build:string) { + return this.pathTemplates.projectLocationBuildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; + } + + /** + * Parse the location from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; + } + + /** + * Parse the build from ProjectLocationBuild resource. + * + * @param {string} projectLocationBuildName + * A fully-qualified path representing project_location_build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { + return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; + } + + /** + * Return a fully-qualified projectLocationTrigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectLocationTriggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; + } + + /** + * Parse the location from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; + } + + /** + * Parse the trigger from ProjectLocationTrigger resource. + * + * @param {string} projectLocationTriggerName + * A fully-qualified path representing project_location_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { + return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; + } + + /** + * Return a fully-qualified projectTrigger resource name string. + * + * @param {string} project + * @param {string} trigger + * @returns {string} Resource name string. + */ + projectTriggerPath(project:string,trigger:string) { + return this.pathTemplates.projectTriggerPathTemplate.render({ + project: project, + trigger: trigger, + }); + } + + /** + * Parse the project from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; + } + + /** + * Parse the trigger from ProjectTrigger resource. + * + * @param {string} projectTriggerName + * A fully-qualified path representing project_trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromProjectTriggerName(projectTriggerName: string) { + return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; + } + + /** + * Return a fully-qualified 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..43b68713910 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts @@ -0,0 +1,3709 @@ +// 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); + request.name = defaultValue3; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); + request.name = defaultValue3; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); + request.parent = defaultValue2; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); + request.name = defaultValue3; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); + request.name = defaultValue3; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + request.trigger ??= {}; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); + request.trigger.resourceName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + request.trigger ??= {}; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); + request.trigger.resourceName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + request.trigger ??= {}; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); + request.trigger.resourceName = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + request.trigger ??= {}; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); + request.trigger.resourceName = defaultValue3; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); + request.name = defaultValue1; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); + request.id = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); + request.triggerId = defaultValue2; + const defaultValue3 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); + request.workerPool.name = defaultValue1; + const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); + request.workerPool.name = defaultValue1; + const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); + request.workerPool.name = defaultValue1; + const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); + request.workerPool.name = defaultValue1; + const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); + request.projectId = defaultValue1; + const defaultValue2 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); + request.parent = defaultValue2; + const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectBuild', () => { + const fakePath = "/rendered/path/projectBuild"; + const expectedParameters = { + project: "projectValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectBuildPath', () => { + const result = client.projectBuildPath("projectValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectBuildName', () => { + const result = client.matchProjectFromProjectBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectBuildName', () => { + const result = client.matchBuildFromProjectBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationBuild', () => { + const fakePath = "/rendered/path/projectLocationBuild"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + build: "buildValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationBuildPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationBuildPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationBuildPath', () => { + const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationBuildName', () => { + const result = client.matchProjectFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationBuildName', () => { + const result = client.matchLocationFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBuildFromProjectLocationBuildName', () => { + const result = client.matchBuildFromProjectLocationBuildName(fakePath); + assert.strictEqual(result, "buildValue"); + assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationTrigger', () => { + const fakePath = "/rendered/path/projectLocationTrigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationTriggerPath', () => { + const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationTriggerName', () => { + const result = client.matchProjectFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationTriggerName', () => { + const result = client.matchLocationFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectLocationTriggerName', () => { + const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectTrigger', () => { + const fakePath = "/rendered/path/projectTrigger"; + const expectedParameters = { + project: "projectValue", + trigger: "triggerValue", + }; + const client = new cloudbuildModule.v1.CloudBuildClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTriggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectTriggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectTriggerPath', () => { + const result = client.projectTriggerPath("projectValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectTriggerName', () => { + const result = client.matchProjectFromProjectTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromProjectTriggerName', () => { + const result = client.matchTriggerFromProjectTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('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..1579ed0b342 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto @@ -0,0 +1,676 @@ +// 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/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 repostiories. +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" + }; + } +} + +// 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; + } + + // 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]; +} + +// 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; +} + +// 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]; +} + +// 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; +} 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_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..d53fb22a1ba --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json @@ -0,0 +1,611 @@ +{ + "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" + } + } + } + } + ] +} 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..e1b9e8003cc --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json @@ -0,0 +1,165 @@ +{ + "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" + ] + }, + "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" + ] + }, + "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..1e11c57a8d1 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts @@ -0,0 +1,2529 @@ +// 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 repostiories. + * @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']; + 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); + } + +/** + * 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..9a588a7f8d9 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json @@ -0,0 +1,102 @@ +{ + "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" + } + } + } + } +} 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..b57f09b2ce6 --- /dev/null +++ b/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts @@ -0,0 +1,3276 @@ +// 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('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 a813a502868ff8f5b12c2aa0f8d1a6431bfee376 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 27 Jun 2023 20:11:09 +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 | 2402 ----------- .../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 | 76 - .../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 | 2960 ------------- .../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 | 3709 ----------------- .../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 | 676 --- ...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 - ...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 | 611 --- .../v2/src/index.ts | 25 - .../v2/src/v2/gapic_metadata.json | 165 - .../v2/src/v2/index.ts | 19 - .../v2/src/v2/repository_manager_client.ts | 2529 ----------- .../v2/repository_manager_client_config.json | 102 - .../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 | 3276 --------------- .../v2/tsconfig.json | 19 - .../v2/webpack.config.js | 64 - .../devtools/cloudbuild/v1/cloudbuild.proto | 45 + .../protos/protos.d.ts | 135 + .../protos/protos.js | 385 ++ .../protos/protos.json | 52 +- .../src/v1/cloud_build_client.ts | 74 + .../test/gapic_cloud_build_v1.ts | 76 + 84 files changed, 765 insertions(+), 20919 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_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 bcefce6b603..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/protos/google/devtools/cloudbuild/v1/cloudbuild.proto +++ /dev/null @@ -1,2402 +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/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: "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.method_signature) = "project_id,build"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Returns information about a previously requested build. - // - // The `Build` that is returned includes its status (such as `SUCCESS`, - // `FAILURE`, or `WORKING`), and timing information. - rpc GetBuild(GetBuildRequest) returns (Build) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds/{id}" - additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Lists previously requested builds. - // - // Previously requested builds may still be in-progress, or may have finished - // successfully or unsuccessfully. - rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/builds" - additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" } - }; - option (google.api.method_signature) = "project_id,filter"; - } - - // Cancels a build in progress. - rpc CancelBuild(CancelBuildRequest) returns (Build) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:cancel" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:cancel" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,id"; - } - - // Creates a new build based on the specified build. - // - // This method creates a new build using the original build request, which may - // or may not result in an identical build. - // - // For triggered builds: - // - // * Triggered builds resolve to a precise revision; therefore a retry of a - // triggered build will result in a build that uses the same revision. - // - // For non-triggered builds that specify `RepoSource`: - // - // * If the original build built from the tip of a branch, the retried build - // will build from the tip of that branch, which may not be the same revision - // as the original build. - // * If the original build specified a commit sha or revision ID, the retried - // build will use the identical source. - // - // For builds that specify `StorageSource`: - // - // * If the original build pulled source from Google Cloud Storage without - // specifying the generation of the object, the new build will use the current - // object, which may be different from the original build source. - // * If the original build pulled source from Cloud Storage and specified the - // generation of the object, the new build will attempt to use the same - // object, which may or may not be available depending on the bucket's - // lifecycle management settings. - rpc RetryBuild(RetryBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/builds/{id}:retry" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:retry" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,id"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Approves or rejects a pending build. - // - // If approved, the returned LRO will be analogous to the LRO returned from - // a CreateBuild call. - // - // If rejected, the returned LRO will be immediately done. - rpc ApproveBuild(ApproveBuildRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/builds/*}:approve" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/builds/*}:approve" - body: "*" - } - }; - option (google.api.method_signature) = "name,approval_result"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // Creates a new `BuildTrigger`. - // - // This API is experimental. - rpc CreateBuildTrigger(CreateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers" - body: "trigger" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/triggers" - body: "trigger" - } - }; - option (google.api.method_signature) = "project_id,trigger"; - } - - // Returns information about a `BuildTrigger`. - // - // This API is experimental. - rpc GetBuildTrigger(GetBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Lists existing `BuildTrigger`s. - // - // This API is experimental. - rpc ListBuildTriggers(ListBuildTriggersRequest) - returns (ListBuildTriggersResponse) { - option (google.api.http) = { - get: "/v1/projects/{project_id}/triggers" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*}/triggers" - } - }; - option (google.api.method_signature) = "project_id"; - } - - // Deletes a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc DeleteBuildTrigger(DeleteBuildTriggerRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/projects/{project_id}/triggers/{trigger_id}" - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/triggers/*}" - } - }; - option (google.api.method_signature) = "project_id,trigger_id"; - } - - // Updates a `BuildTrigger` by its project ID and trigger ID. - // - // This API is experimental. - rpc UpdateBuildTrigger(UpdateBuildTriggerRequest) returns (BuildTrigger) { - option (google.api.http) = { - patch: "/v1/projects/{project_id}/triggers/{trigger_id}" - body: "trigger" - additional_bindings { - patch: "/v1/{trigger.resource_name=projects/*/locations/*/triggers/*}" - body: "trigger" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,trigger"; - } - - // Runs a `BuildTrigger` at a particular source revision. - rpc RunBuildTrigger(RunBuildTriggerRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger_id}:run" - body: "source" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:run" - body: "*" - } - }; - option (google.api.method_signature) = "project_id,trigger_id,source"; - option (google.longrunning.operation_info) = { - response_type: "Build" - metadata_type: "BuildOperationMetadata" - }; - } - - // ReceiveTriggerWebhook [Experimental] is called when the API receives a - // webhook request targeted at a specific trigger. - rpc ReceiveTriggerWebhook(ReceiveTriggerWebhookRequest) - returns (ReceiveTriggerWebhookResponse) { - option (google.api.http) = { - post: "/v1/projects/{project_id}/triggers/{trigger}:webhook" - body: "body" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/triggers/*}:webhook" - body: "body" - } - }; - } - - // Creates a `WorkerPool`. - rpc CreateWorkerPool(CreateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/workerPools" - body: "worker_pool" - }; - option (google.api.method_signature) = "parent,worker_pool,worker_pool_id"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "CreateWorkerPoolOperationMetadata" - }; - } - - // Returns details of a `WorkerPool`. - rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a `WorkerPool`. - rpc DeleteWorkerPool(DeleteWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/workerPools/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteWorkerPoolOperationMetadata" - }; - } - - // Updates a `WorkerPool`. - rpc UpdateWorkerPool(UpdateWorkerPoolRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{worker_pool.name=projects/*/locations/*/workerPools/*}" - body: "worker_pool" - }; - option (google.api.method_signature) = "worker_pool,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "WorkerPool" - metadata_type: "UpdateWorkerPoolOperationMetadata" - }; - } - - // Lists `WorkerPool`s. - rpc ListWorkerPools(ListWorkerPoolsRequest) - returns (ListWorkerPoolsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/workerPools" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Specifies a build to retry. -message RetryBuildRequest { - // The name of the `Build` to retry. - // Format: `projects/{project}/locations/{location}/builds/{build}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/Build" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Build ID of the original build. - string id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Specifies a build trigger to run and the source to use. -message RunBuildTriggerRequest { - // The name of the `Trigger` to run. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 4 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the trigger. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Source to build against this trigger. - RepoSource source = 3; -} - -// Location of the source in an archive file in Google Cloud Storage. -message StorageSource { - // Google Cloud Storage bucket containing the source (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source. - // - // This object must be a gzipped archive file (`.tar.gz`) containing source to - // build. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in 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 Google Cloud Storage. -// This feature is in Preview; see description -// [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). -message StorageSourceManifest { - // Google Cloud Storage bucket containing the source manifest (see [Bucket - // Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - string bucket = 1; - - // Google Cloud Storage object containing the source manifest. - // - // This object must be a JSON file. - string object = 2; - - // Google Cloud Storage generation for the object. If the generation is - // omitted, the latest generation will be used. - int64 generation = 3; -} - -// Location of the source in a supported storage service. -message Source { - // Location of source. - oneof source { - // If provided, get the source from this location in Google Cloud Storage. - StorageSource storage_source = 2; - - // If provided, get the source from this location in a Cloud Source - // Repository. - RepoSource repo_source = 3; - - // If provided, get the source from this Git repository. - GitSource git_source = 5; - - // If provided, get the source from this manifest in Google Cloud Storage. - // This feature is in Preview; see description - // [here](https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/gcs-fetcher). - StorageSourceManifest storage_source_manifest = 8; - } -} - -// An image built by the pipeline. -message BuiltImage { - // Name used to push the container image to Google Container Registry, as - // presented to `docker push`. - string name = 1; - - // Docker Registry 2.0 digest. - string digest = 3; - - // Output only. Stores timing information for pushing the specified image. - TimeSpan push_timing = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// 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 Google Cloud Storage bucket, with the - // generation number. For example, - // `gs://mybucket/path/to/output.jar#generation`. - string location = 1; - - // The file hash of the artifact. - repeated FileHashes file_hash = 2; -} - -// A build resource in the Cloud Build API. -// -// At a high level, a `Build` describes where to find source code, how to build -// it (for example, the builder image to run on the source), and where to store -// the built artifacts. -// -// Fields can include the following variables, which will be expanded when the -// build is created: -// -// - $PROJECT_ID: the project ID of the build. -// - $PROJECT_NUMBER: the project number of the build. -// - $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; - - // Google Cloud Storage bucket where logs should be written (see - // [Bucket Name - // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - // Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. - string logs_bucket = 19; - - // Output only. A permanent fixed identifier for source. - SourceProvenance source_provenance = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ID of the `BuildTrigger` that triggered this build, if it - // was triggered automatically. - string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Special options for this build. - BuildOptions options = 23; - - // Output only. URL to logs for this build in Google Cloud Console. - string log_url = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Substitutions data for `Build` resource. - map substitutions = 29; - - // Tags for annotation of a `Build`. These are not docker tags. - repeated string tags = 31; - - // Secrets to decrypt using Cloud Key Management Service. - // Note: Secret Manager is the recommended technique - // for managing sensitive data with Cloud Build. Use `available_secrets` to - // configure builds to access secrets from Secret Manager. For instructions, - // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets - repeated Secret secrets = 32; - - // Output only. Stores timing information for phases of the build. Valid keys - // are: - // - // * BUILD: time to execute all build steps. - // * PUSH: time to push all 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]; -} - -// Configuration for an automated build in response to source repository -// changes. -message BuildTrigger { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - plural: "triggers" - singular: "trigger" - pattern: "projects/{project}/triggers/{trigger}" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" - }; - - // The `Trigger` name with format: - // `projects/{project}/locations/{location}/triggers/{trigger}`, where - // {trigger} is a unique identifier generated by the service. - string resource_name = 34; - - // Output only. Unique identifier of the trigger. - string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Human-readable description of this trigger. - string description = 10; - - // User-assigned name of the trigger. Must be unique within the project. - // Trigger names must meet the following requirements: - // - // + They must contain only alphanumeric characters and dashes. - // + They can be 1-64 characters long. - // + They must begin and end with an alphanumeric character. - string name = 21; - - // Tags for annotation of a `BuildTrigger` - repeated string tags = 19; - - // Template describing the types of source changes to trigger a build. - // - // Branch and tag names in trigger templates are interpreted as regular - // expressions. Any branch or tag change that matches that regular expression - // will trigger a build. - // - // Mutually exclusive with `github`. - RepoSource trigger_template = 7; - - // GitHubEventsConfig describes the configuration of a trigger that creates - // a build whenever a GitHub event is received. - // - // Mutually exclusive with `trigger_template`. - GitHubEventsConfig github = 13; - - // PubsubConfig describes the configuration of a trigger that - // creates a build whenever a Pub/Sub message is published. - PubsubConfig pubsub_config = 29; - - // WebhookConfig describes the configuration of a trigger that - // creates a build whenever a webhook is sent to a trigger's webhook URL. - WebhookConfig webhook_config = 31; - - // Template describing the Build request to make when the trigger is matched. - oneof build_template { - // Autodetect build configuration. The following precedence is used (case - // insensitive): - // - // 1. cloudbuild.yaml - // 2. cloudbuild.yml - // 3. cloudbuild.json - // 4. Dockerfile - // - // Currently only available for GitHub App Triggers. - bool autodetect = 18; - - // Contents of the build template. - Build build = 4; - - // Path, from the source root, to the build configuration file - // (i.e. cloudbuild.yaml). - string filename = 8; - } - - // Output only. Time when the trigger was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If true, the trigger will never automatically execute a build. - bool disabled = 9; - - // Substitutions for Build resource. The keys must match the following - // regular expression: `^_[A-Z0-9_]+$`. - map substitutions = 11; - - // ignored_files and included_files are file glob matches using - // https://golang.org/pkg/path/filepath/#Match extended with support for "**". - // - // If ignored_files and changed files are both empty, then they are - // not used to determine whether or not to trigger a build. - // - // If ignored_files is not empty, then we ignore any files that match - // any of the ignored_file globs. If the change has no files that are - // outside of the ignored_files globs, then we do not trigger a build. - repeated string ignored_files = 15; - - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is empty, then as far as this filter is - // concerned, we should trigger the build. - // - // If any of the files altered in the commit pass the ignored_files - // filter and included_files is not empty, then we make sure that at - // least one of those files matches a included_files glob. If not, - // then we do not trigger a build. - repeated string included_files = 16; - - // Optional. A Common Expression Language string. - string filter = 30 [(google.api.field_behavior) = OPTIONAL]; - - // The service account used for all user-controlled operations including - // UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. - // If no service account is set, then the standard Cloud Build service account - // ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead. - // Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}` - string service_account = 33 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // 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. -// -// This message is experimental. -message GitHubEventsConfig { - // The installationID that emits the GitHub event. - int64 installation_id = 1 [deprecated = true]; - - // Owner of the repository. For example: The owner for - // https://github.com/googlecloudplatform/cloud-builders is - // "googlecloudplatform". - string owner = 6; - - // Name of the repository. For example: The name for - // https://github.com/googlecloudplatform/cloud-builders is "cloud-builders". - string name = 7; - - // Filter describing the types of events to trigger a build. - // Currently supported event types: push, pull_request. - oneof event { - // filter to match changes in pull requests. - PullRequestFilter pull_request = 4; - - // filter to match changes in refs like branches, tags. - PushFilter push = 5; - } -} - -// PubsubConfig describes the configuration of a trigger that -// creates a build whenever a Pub/Sub message is published. -message PubsubConfig { - // Enumerates potential issues with the underlying Pub/Sub subscription - // configuration. - enum State { - // The subscription configuration has not been checked. - STATE_UNSPECIFIED = 0; - - // The Pub/Sub subscription is properly configured. - OK = 1; - - // The subscription has been deleted. - SUBSCRIPTION_DELETED = 2; - - // The topic has been deleted. - TOPIC_DELETED = 3; - - // Some of the subscription's field are misconfigured. - SUBSCRIPTION_MISCONFIGURED = 4; - } - - // Output only. Name of the subscription. Format is - // `projects/{project}/subscriptions/{subscription}`. - string subscription = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // The name of the topic from which this subscription is receiving messages. - // Format is `projects/{project}/topics/{topic}`. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Service account that will make the push request. - string service_account_email = 3 [(google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - }]; - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// WebhookConfig describes the configuration of a trigger that -// creates a build whenever a webhook is sent to a trigger's webhook URL. -message WebhookConfig { - // Enumerates potential issues with the Secret Manager secret provided by the - // user. - enum State { - // The webhook auth configuration not been checked. - STATE_UNSPECIFIED = 0; - - // The auth configuration is properly setup. - OK = 1; - - // The secret provided in auth_method has been deleted. - SECRET_DELETED = 2; - } - - // Auth method specifies how the webhook authenticates with GCP. - oneof auth_method { - // Required. Resource name for the secret required as a URL parameter. - string secret = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - } - - // Potential issues with the underlying Pub/Sub subscription configuration. - // Only populated on get requests. - State state = 4; -} - -// PullRequestFilter contains filter properties for matching GitHub Pull -// Requests. -message PullRequestFilter { - // Controls behavior of Pull Request comments. - enum CommentControl { - // Do not require comments on Pull Requests before builds are triggered. - COMMENTS_DISABLED = 0; - - // Enforce that repository owners or collaborators must comment on Pull - // Requests before builds are triggered. - COMMENTS_ENABLED = 1; - - // Enforce that repository owners or collaborators must comment on external - // contributors' Pull Requests before builds are triggered. - COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2; - } - - // Target refs to match. - // A target ref is the git reference where the pull request will be applied. - oneof git_ref { - // Regex of branches to match. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch = 2; - } - - // Configure builds to run whether a repository owner or collaborator need to - // comment `/gcbrun`. - CommentControl comment_control = 5; - - // If true, branches that do NOT match the git_ref will trigger a build. - bool invert_regex = 6; -} - -// Push contains filter properties for matching GitHub git pushes. -message PushFilter { - // Modified refs to match. - // A modified refs are the refs modified by a git push operation. - oneof git_ref { - // Regexes matching branches to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string branch = 2; - - // Regexes matching tags to build. - // - // The syntax of the regular expressions accepted is the syntax accepted by - // RE2 and described at https://github.com/google/re2/wiki/Syntax - string tag = 3; - } - - // When true, only trigger a build if the revision regex does NOT match the - // git_ref regex. - bool invert_regex = 4; -} - -// Request to create a new `BuildTrigger`. -message CreateBuildTriggerRequest { - // The parent resource where this trigger will be created. - // Format: `projects/{project}/locations/{location}` - string parent = 3 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to configure automatic builds. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to create. - BuildTrigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Returns the `BuildTrigger` with the specified ID. -message GetBuildTriggerRequest { - // The name of the `Trigger` to retrieve. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list existing `BuildTriggers`. -message ListBuildTriggersRequest { - // The parent of the collection of `Triggers`. - // Format: `projects/{project}/locations/{location}` - string parent = 4 [(google.api.resource_reference) = { - child_type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project for which to list BuildTriggers. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Number of results to return in the list. - int32 page_size = 2; - - // Token to provide to skip to a particular spot in the list. - string page_token = 3; -} - -// Response containing existing `BuildTriggers`. -message ListBuildTriggersResponse { - // `BuildTriggers` for the project, sorted by `create_time` descending. - repeated BuildTrigger triggers = 1; - - // Token to receive the next page of results. - string next_page_token = 2; -} - -// Request to delete a `BuildTrigger`. -message DeleteBuildTriggerRequest { - // The name of the `Trigger` to delete. - // Format: `projects/{project}/locations/{location}/triggers/{trigger}` - string name = 3 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/BuildTrigger" - }]; - - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to delete. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to update an existing `BuildTrigger`. -message UpdateBuildTriggerRequest { - // Required. ID of the project that owns the trigger. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the `BuildTrigger` to update. - string trigger_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. `BuildTrigger` to update. - BuildTrigger trigger = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Optional arguments to enable specific features of builds. -message BuildOptions { - // Details about how a build should be executed on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - message PoolOption { - // The `WorkerPool` resource to execute the build on. - // You must have `cloudbuild.workerpools.use` on the project hosting the - // WorkerPool. - // - // Format projects/{project}/locations/{location}/workerPools/{workerPoolId} - string name = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - } - - // Specifies the manner in which the build should be verified, if at all. - enum VerifyOption { - // Not a verifiable build (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; - } - - // Specifies the behavior when there is an error in the substitution checks. - enum SubstitutionOption { - // Fails the build if error in substitutions checks, like missing - // a substitution in the template or in the map. - MUST_MATCH = 0; - - // Do not fail the build if error in substitutions checks. - ALLOW_LOOSE = 1; - } - - // Specifies the behavior when writing build logs to Google Cloud Storage. - enum LogStreamingOption { - // Service may automatically determine build log streaming behavior. - STREAM_DEFAULT = 0; - - // Build logs should be streamed to Google Cloud Storage. - STREAM_ON = 1; - - // Build logs should not be streamed to Google Cloud Storage; they will be - // written when the build is completed. - STREAM_OFF = 2; - } - - // Specifies the logging mode. - enum LoggingMode { - // The service determines the logging mode. The default is `LEGACY`. Do not - // rely on the default logging behavior as it may change in the future. - LOGGING_UNSPECIFIED = 0; - - // 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 Google Cloud - // Storage. - LogStreamingOption log_streaming_option = 5; - - // This field deprecated; please use `pool.name` instead. - string worker_pool = 7 [deprecated = true]; - - // Optional. Specification for execution on a `WorkerPool`. - // - // See [running builds in a private - // pool](https://cloud.google.com/build/docs/private-pools/run-builds-in-private-pool) - // for more information. - PoolOption pool = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Option to specify the logging mode, which determines if and where build - // logs are stored. - LoggingMode logging = 11; - - // A list of global environment variable definitions that will exist for all - // build steps in this build. If a variable is defined in both globally and in - // a build step, the variable will use the build step value. - // - // The elements are of the form "KEY=VALUE" for the environment variable "KEY" - // being given the value "VALUE". - repeated string env = 12; - - // A list of global environment variables, which are encrypted using a Cloud - // Key Management Service crypto key. These values must be specified in the - // build's `Secret`. These variables will be available to all build steps - // in this build. - repeated string secret_env = 13; - - // Global list of volumes to mount for ALL build steps - // - // Each volume is created as an empty volume prior to starting the build - // process. Upon completion of the build, volumes and their contents are - // discarded. Global volume names and paths cannot conflict with the volumes - // defined a build step. - // - // Using a global volume in a build with only one step is not valid as - // it is indicative of a build request with an incorrect configuration. - repeated Volume volumes = 14; - - // 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 {} - -// Configuration for a `WorkerPool`. -// -// Cloud Build owns and maintains a pool of workers for general use and have no -// access to a project's private network. By default, builds submitted to -// Cloud Build will use a worker from this pool. -// -// If your build needs access to resources on a private network, -// create and use a `WorkerPool` to run your builds. Private `WorkerPool`s give -// your builds access to any single VPC network that you -// administer, including any on-prem resources connected to that VPC -// network. For an overview of private pools, see -// [Private pools -// overview](https://cloud.google.com/build/docs/private-pools/private-pools-overview). -message WorkerPool { - option (google.api.resource) = { - type: "cloudbuild.googleapis.com/WorkerPool" - pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" - plural: "workerPools" - singular: "workerPool" - style: DECLARATIVE_FRIENDLY - }; - - // State of the `WorkerPool`. - enum State { - // State of the `WorkerPool` is unknown. - STATE_UNSPECIFIED = 0; - - // `WorkerPool` is being created. - CREATING = 1; - - // `WorkerPool` is running. - RUNNING = 2; - - // `WorkerPool` is being deleted: cancelling builds and draining workers. - DELETING = 3; - - // `WorkerPool` is deleted. - DELETED = 4; - } - - // Output only. The resource name of the `WorkerPool`, with format - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - // The value of `{worker_pool}` is provided by `worker_pool_id` in - // `CreateWorkerPool` request and the value of `{location}` is determined by - // the endpoint accessed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-specified, human-readable name for the `WorkerPool`. If provided, - // this value must be 1-63 characters. - string display_name = 2; - - // Output only. A unique identifier for the `WorkerPool`. - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User specified annotations. See https://google.aip.dev/128#annotations - // for more details such as format and size limitations. - map annotations = 4; - - // Output only. Time at which the request to create the `WorkerPool` was - // received. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to update the `WorkerPool` was - // received. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time at which the request to delete the `WorkerPool` was - // received. - google.protobuf.Timestamp delete_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. `WorkerPool` state. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // 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 this is provided, it must match the server's etag on the - // workerpool for the request to be processed. - string etag = 2; - - // If set to true, and the `WorkerPool` is not found, the request will succeed - // but no action will be taken on the server. - bool allow_missing = 3; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to update a `WorkerPool`. -message UpdateWorkerPoolRequest { - // Required. The `WorkerPool` to update. - // - // The `name` field is used to identify the `WorkerPool` to update. - // Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`. - WorkerPool worker_pool = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask specifying which fields in `worker_pool` to update. - google.protobuf.FieldMask update_mask = 2; - - // If set, validate the request and preview the response, but do not actually - // post it. - bool validate_only = 4; -} - -// Request to list `WorkerPool`s. -message ListWorkerPoolsRequest { - // Required. The parent of the collection of `WorkerPools`. - // Format: `projects/{project}/locations/{location}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of `WorkerPool`s to return. The service may return - // fewer than this value. If omitted, the server will use a sensible default. - int32 page_size = 2; - - // A page token, received from a previous `ListWorkerPools` call. Provide this - // to retrieve the subsequent page. - string page_token = 3; -} - -// Response containing existing `WorkerPools`. -message ListWorkerPoolsResponse { - // `WorkerPools` for the specified project. - repeated WorkerPool worker_pools = 1; - - // Continuation token used to page through large result sets. Provide this - // value in a subsequent ListWorkerPoolsRequest to return the next page of - // results. - string next_page_token = 2; -} - -// Metadata for the `CreateWorkerPool` operation. -message CreateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` to create. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `UpdateWorkerPool` operation. -message UpdateWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being updated. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} - -// Metadata for the `DeleteWorkerPool` operation. -message DeleteWorkerPoolOperationMetadata { - // The resource name of the `WorkerPool` being deleted. - // Format: - // `projects/{project}/locations/{location}/workerPools/{worker_pool}`. - string worker_pool = 1 [(google.api.resource_reference) = { - type: "cloudbuild.googleapis.com/WorkerPool" - }]; - - // Time the operation was created. - google.protobuf.Timestamp create_time = 2; - - // Time the operation was completed. - google.protobuf.Timestamp complete_time = 3; -} diff --git a/owl-bot-staging/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 6cc8670f518..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 this is provided, it must match the server's etag on the - * workerpool for the request to be processed. - */ - // const etag = 'abc123' - /** - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - */ - // const allowMissing = true - /** - * If set, validate the request and preview the response, but do not actually - * post it. - */ - // const validateOnly = true - - // Imports the Cloudbuild library - const {CloudBuildClient} = require('@google-cloud/cloudbuild').v1; - - // Instantiates a client - const cloudbuildClient = new CloudBuildClient(); - - async function callDeleteWorkerPool() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await cloudbuildClient.deleteWorkerPool(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteWorkerPool(); - // [END cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/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 c458a03276f..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/samples/generated/v1/cloud_build.run_build_trigger.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, 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. - */ - // 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 055af432bce..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 Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source. * If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.", - "canonical": true, - "file": "cloud_build.retry_build.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 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.", - "canonical": true, - "file": "cloud_build.run_build_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "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 8d54e73aea8..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/src/v1/cloud_build_client.ts +++ /dev/null @@ -1,2960 +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}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/builds/{build}' - ), - projectLocationBuildPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/builds/{build}' - ), - projectLocationTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - projectTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/triggers/{trigger}' - ), - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'id': request.id ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBuild(request, options, callback); - } -/** - * Cancels a build in progress. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to cancel. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. ID of the build. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'id': request.id ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.cancelBuild(request, options, callback); - } -/** - * Creates a new `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this trigger will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to configure automatic builds. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBuildTrigger(request, options, callback); - } -/** - * Returns information about a `BuildTrigger`. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. Identifier (`id` or `name`) of the `BuildTrigger` to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'trigger_id': request.triggerId ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBuildTrigger(request, options, callback); - } -/** - * Deletes a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to delete. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'trigger_id': request.triggerId ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBuildTrigger(request, options, callback); - } -/** - * Updates a `BuildTrigger` by its project ID and trigger ID. - * - * This API is experimental. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. ID of the project that owns the trigger. - * @param {string} request.triggerId - * Required. ID of the `BuildTrigger` to update. - * @param {google.devtools.cloudbuild.v1.BuildTrigger} request.trigger - * Required. `BuildTrigger` to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'trigger_id': request.triggerId ?? '', - 'trigger.resource_name': request.trigger!.resourceName ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateBuildTrigger(request, options, callback); - } -/** - * ReceiveTriggerWebhook [Experimental] is called when the API receives a - * webhook request targeted at a specific trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `ReceiveTriggerWebhook` to retrieve. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {google.api.HttpBody} request.body - * HTTP request body. - * @param {string} request.projectId - * Project in which the specified trigger lives - * @param {string} request.trigger - * Name of the trigger to run the payload against - * @param {string} request.secret - * Secret token used for authorization if an OAuth token isn't provided. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getWorkerPool(request, options, callback); - } - -/** - * Starts a build with the specified configuration. - * - * This method returns a long-running `Operation`, which includes the build - * ID. Pass the build ID to `GetBuild` to determine the build status (such as - * `SUCCESS` or `FAILURE`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource where this build will be created. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {google.devtools.cloudbuild.v1.Build} request.build - * Required. Build resource to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBuild( - request?: protos.google.devtools.cloudbuild.v1.ICreateBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateBuild_async - */ - async checkCreateBuildProgress(name: string): Promise>{ - const request = new 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 Google Cloud Storage without - * specifying the generation of the object, the new build will use the current - * object, which may be different from the original build source. - * * If the original build pulled source from Cloud Storage and specified the - * generation of the object, the new build will attempt to use the same - * object, which may or may not be available depending on the bucket's - * lifecycle management settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Build` to retry. - * Format: `projects/{project}/locations/{location}/builds/{build}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.id - * Required. Build ID of the original build. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - retryBuild( - request?: protos.google.devtools.cloudbuild.v1.IRetryBuildRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'id': request.id ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.retryBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `retryBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.retry_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RetryBuild_async - */ - async checkRetryBuildProgress(name: string): Promise>{ - const request = new 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.approveBuild(request, options, callback); - } -/** - * Check the status of the long running operation returned by `approveBuild()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.approve_build.js - * region_tag:cloudbuild_v1_generated_CloudBuild_ApproveBuild_async - */ - async checkApproveBuildProgress(name: string): Promise>{ - const request = new 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of the `Trigger` to run. - * Format: `projects/{project}/locations/{location}/triggers/{trigger}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {string} request.triggerId - * Required. ID of the trigger. - * @param {google.devtools.cloudbuild.v1.RepoSource} request.source - * Source to build against this trigger. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runBuildTrigger( - request?: protos.google.devtools.cloudbuild.v1.IRunBuildTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'trigger_id': request.triggerId ?? '', - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.runBuildTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runBuildTrigger()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.run_build_trigger.js - * region_tag:cloudbuild_v1_generated_CloudBuild_RunBuildTrigger_async - */ - async checkRunBuildTriggerProgress(name: string): Promise>{ - const request = new 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.create_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_CreateWorkerPool_async - */ - async checkCreateWorkerPoolProgress(name: string): Promise>{ - const request = new 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 this is provided, it must match the server's etag on the - * workerpool for the request to be processed. - * @param {boolean} request.allowMissing - * If set to true, and the `WorkerPool` is not found, the request will succeed - * but no action will be taken on the server. - * @param {boolean} request.validateOnly - * If set, validate the request and preview the response, but do not actually - * post it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteWorkerPool( - request?: protos.google.devtools.cloudbuild.v1.IDeleteWorkerPoolRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.delete_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_DeleteWorkerPool_async - */ - async checkDeleteWorkerPoolProgress(name: string): Promise>{ - const request = new 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'worker_pool.name': request.workerPool!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateWorkerPool(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateWorkerPool()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/cloud_build.update_worker_pool.js - * region_tag:cloudbuild_v1_generated_CloudBuild_UpdateWorkerPool_async - */ - async checkUpdateWorkerPoolProgress(name: string): Promise>{ - const request = new 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBuilds(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Builds`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * The page token for the next page of Builds. - * - * If unspecified, the first page of results is returned. - * - * If the token is rejected for any reason, INVALID_ARGUMENT will be thrown. - * In this case, the token should be discarded, and pagination should be - * restarted from the first page of results. - * - * See https://google.aip.dev/158 for more. - * @param {string} request.filter - * The raw filter text to constrain the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.createStream( - this.innerApiCalls.listBuilds as 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuilds']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuilds.asyncIterate( - this.innerApiCalls['listBuilds'] as GaxCall, - request as {}, - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBuildTriggers(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent of the collection of `Triggers`. - * Format: `projects/{project}/locations/{location}` - * @param {string} request.projectId - * Required. ID of the project for which to list BuildTriggers. - * @param {number} request.pageSize - * Number of results to return in the list. - * @param {string} request.pageToken - * Token to provide to skip to a particular spot in the list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.createStream( - this.innerApiCalls.listBuildTriggers as 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId ?? '', - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuildTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBuildTriggers.asyncIterate( - this.innerApiCalls['listBuildTriggers'] as GaxCall, - request as {}, - 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listWorkerPools(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent of the collection of `WorkerPools`. - * Format: `projects/{project}/locations/{location}`. - * @param {number} request.pageSize - * The maximum number of `WorkerPool`s to return. The service may return - * fewer than this value. If omitted, the server will use a sensible default. - * @param {string} request.pageToken - * A page token, received from a previous `ListWorkerPools` call. Provide this - * to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.createStream( - this.innerApiCalls.listWorkerPools as 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listWorkerPools']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listWorkerPools.asyncIterate( - this.innerApiCalls['listWorkerPools'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} keyring - * @param {string} key - * @returns {string} Resource name string. - */ - cryptoKeyPath(project:string,location:string,keyring:string,key:string) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - keyring: keyring, - key: key, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; - } - - /** - * Parse the keyring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the keyring. - */ - matchKeyringFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).keyring; - } - - /** - * Parse the key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key. - */ - matchKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectBuild resource name string. - * - * @param {string} project - * @param {string} build - * @returns {string} Resource name string. - */ - projectBuildPath(project:string,build:string) { - return this.pathTemplates.projectBuildPathTemplate.render({ - project: project, - build: build, - }); - } - - /** - * Parse the project from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).project; - } - - /** - * Parse the build from ProjectBuild resource. - * - * @param {string} projectBuildName - * A fully-qualified path representing project_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectBuildName(projectBuildName: string) { - return this.pathTemplates.projectBuildPathTemplate.match(projectBuildName).build; - } - - /** - * Return a fully-qualified projectLocationBuild resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} build - * @returns {string} Resource name string. - */ - projectLocationBuildPath(project:string,location:string,build:string) { - return this.pathTemplates.projectLocationBuildPathTemplate.render({ - project: project, - location: location, - build: build, - }); - } - - /** - * Parse the project from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).project; - } - - /** - * Parse the location from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).location; - } - - /** - * Parse the build from ProjectLocationBuild resource. - * - * @param {string} projectLocationBuildName - * A fully-qualified path representing project_location_build resource. - * @returns {string} A string representing the build. - */ - matchBuildFromProjectLocationBuildName(projectLocationBuildName: string) { - return this.pathTemplates.projectLocationBuildPathTemplate.match(projectLocationBuildName).build; - } - - /** - * Return a fully-qualified projectLocationTrigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectLocationTriggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).project; - } - - /** - * Parse the location from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).location; - } - - /** - * Parse the trigger from ProjectLocationTrigger resource. - * - * @param {string} projectLocationTriggerName - * A fully-qualified path representing project_location_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectLocationTriggerName(projectLocationTriggerName: string) { - return this.pathTemplates.projectLocationTriggerPathTemplate.match(projectLocationTriggerName).trigger; - } - - /** - * Return a fully-qualified projectTrigger resource name string. - * - * @param {string} project - * @param {string} trigger - * @returns {string} Resource name string. - */ - projectTriggerPath(project:string,trigger:string) { - return this.pathTemplates.projectTriggerPathTemplate.render({ - project: project, - trigger: trigger, - }); - } - - /** - * Parse the project from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).project; - } - - /** - * Parse the trigger from ProjectTrigger resource. - * - * @param {string} projectTriggerName - * A fully-qualified path representing project_trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromProjectTriggerName(projectTriggerName: string) { - return this.pathTemplates.projectTriggerPathTemplate.match(projectTriggerName).trigger; - } - - /** - * Return a fully-qualified 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 43b68713910..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v1/test/gapic_cloud_build_v1.ts +++ /dev/null @@ -1,3709 +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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildRequest', ['name']); - request.name = defaultValue3; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CancelBuildRequest', ['name']); - request.name = defaultValue3; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest', ['parent']); - request.parent = defaultValue2; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetBuildTriggerRequest', ['name']); - request.name = defaultValue3; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest', ['name']); - request.name = defaultValue3; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - request.trigger ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); - request.trigger.resourceName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - request.trigger ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); - request.trigger.resourceName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - request.trigger ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); - request.trigger.resourceName = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&trigger.resource_name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - request.trigger ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest', ['trigger', 'resourceName']); - request.trigger.resourceName = defaultValue3; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.GetWorkerPoolRequest', ['name']); - request.name = defaultValue1; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateBuildRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['id']); - request.id = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RetryBuildRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ApproveBuildRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['triggerId']); - request.triggerId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.RunBuildTriggerRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&trigger_id=${defaultValue2}&name=${defaultValue3}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); - request.workerPool.name = defaultValue1; - const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); - request.workerPool.name = defaultValue1; - const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); - request.workerPool.name = defaultValue1; - const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest', ['workerPool', 'name']); - request.workerPool.name = defaultValue1; - const expectedHeaderRequestParams = `worker_pool.name=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildsRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListBuildTriggersRequest', ['parent']); - request.parent = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1}&parent=${defaultValue2}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectBuild', () => { - const fakePath = "/rendered/path/projectBuild"; - const expectedParameters = { - project: "projectValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectBuildPath', () => { - const result = client.projectBuildPath("projectValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectBuildName', () => { - const result = client.matchProjectFromProjectBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectBuildName', () => { - const result = client.matchBuildFromProjectBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBuild', () => { - const fakePath = "/rendered/path/projectLocationBuild"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - build: "buildValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationBuildPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBuildPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBuildPath', () => { - const result = client.projectLocationBuildPath("projectValue", "locationValue", "buildValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBuildPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBuildName', () => { - const result = client.matchProjectFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBuildName', () => { - const result = client.matchLocationFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBuildFromProjectLocationBuildName', () => { - const result = client.matchBuildFromProjectLocationBuildName(fakePath); - assert.strictEqual(result, "buildValue"); - assert((client.pathTemplates.projectLocationBuildPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationTrigger', () => { - const fakePath = "/rendered/path/projectLocationTrigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationTriggerPath', () => { - const result = client.projectLocationTriggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationTriggerName', () => { - const result = client.matchProjectFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationTriggerName', () => { - const result = client.matchLocationFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectLocationTriggerName', () => { - const result = client.matchTriggerFromProjectLocationTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectLocationTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectTrigger', () => { - const fakePath = "/rendered/path/projectTrigger"; - const expectedParameters = { - project: "projectValue", - trigger: "triggerValue", - }; - const client = new cloudbuildModule.v1.CloudBuildClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectTriggerPath', () => { - const result = client.projectTriggerPath("projectValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectTriggerName', () => { - const result = client.matchProjectFromProjectTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromProjectTriggerName', () => { - const result = client.matchTriggerFromProjectTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.projectTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('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 1579ed0b342..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/protos/google/devtools/cloudbuild/v2/repositories.proto +++ /dev/null @@ -1,676 +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/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 repostiories. -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" - }; - } -} - -// 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; - } - - // 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]; -} - -// 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; -} - -// 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]; -} - -// 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; -} 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_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 d53fb22a1ba..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/samples/generated/v2/snippet_metadata.google.devtools.cloudbuild.v2.json +++ /dev/null @@ -1,611 +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" - } - } - } - } - ] -} 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 e1b9e8003cc..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,165 +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" - ] - }, - "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" - ] - }, - "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 1e11c57a8d1..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client.ts +++ /dev/null @@ -1,2529 +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 repostiories. - * @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']; - 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); - } - -/** - * 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 9a588a7f8d9..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/src/v2/repository_manager_client_config.json +++ /dev/null @@ -1,102 +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" - } - } - } - } -} 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 b57f09b2ce6..00000000000 --- a/owl-bot-staging/google-devtools-cloudbuild/v2/test/gapic_repository_manager_v2.ts +++ /dev/null @@ -1,3276 +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('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 cc2b1dd56a2..bcefce6b603 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 @@ -62,6 +62,10 @@ 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. // @@ -1575,6 +1579,47 @@ message BuildTrigger { 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 diff --git a/packages/google-devtools-cloudbuild/protos/protos.d.ts b/packages/google-devtools-cloudbuild/protos/protos.d.ts index 6e49890d60a..0e0b31b4e56 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.d.ts +++ b/packages/google-devtools-cloudbuild/protos/protos.d.ts @@ -5292,6 +5292,9 @@ export namespace google { /** BuildTrigger serviceAccount */ serviceAccount?: (string|null); + + /** BuildTrigger repositoryEventConfig */ + repositoryEventConfig?: (google.devtools.cloudbuild.v1.IRepositoryEventConfig|null); } /** Represents a BuildTrigger. */ @@ -5360,6 +5363,9 @@ export namespace google { /** BuildTrigger serviceAccount. */ public serviceAccount: string; + /** BuildTrigger repositoryEventConfig. */ + public repositoryEventConfig?: (google.devtools.cloudbuild.v1.IRepositoryEventConfig|null); + /** BuildTrigger buildTemplate. */ public buildTemplate?: ("autodetect"|"build"|"filename"); @@ -5441,6 +5447,135 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a RepositoryEventConfig. */ + interface IRepositoryEventConfig { + + /** RepositoryEventConfig repository */ + repository?: (string|null); + + /** RepositoryEventConfig repositoryType */ + repositoryType?: (google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType|keyof typeof google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType|null); + + /** RepositoryEventConfig pullRequest */ + pullRequest?: (google.devtools.cloudbuild.v1.IPullRequestFilter|null); + + /** RepositoryEventConfig push */ + push?: (google.devtools.cloudbuild.v1.IPushFilter|null); + } + + /** Represents a RepositoryEventConfig. */ + class RepositoryEventConfig implements IRepositoryEventConfig { + + /** + * Constructs a new RepositoryEventConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.cloudbuild.v1.IRepositoryEventConfig); + + /** RepositoryEventConfig repository. */ + public repository: string; + + /** RepositoryEventConfig repositoryType. */ + public repositoryType: (google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType|keyof typeof google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType); + + /** RepositoryEventConfig pullRequest. */ + public pullRequest?: (google.devtools.cloudbuild.v1.IPullRequestFilter|null); + + /** RepositoryEventConfig push. */ + public push?: (google.devtools.cloudbuild.v1.IPushFilter|null); + + /** RepositoryEventConfig filter. */ + public filter?: ("pullRequest"|"push"); + + /** + * Creates a new RepositoryEventConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns RepositoryEventConfig instance + */ + public static create(properties?: google.devtools.cloudbuild.v1.IRepositoryEventConfig): google.devtools.cloudbuild.v1.RepositoryEventConfig; + + /** + * Encodes the specified RepositoryEventConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * @param message RepositoryEventConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.cloudbuild.v1.IRepositoryEventConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RepositoryEventConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * @param message RepositoryEventConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.cloudbuild.v1.IRepositoryEventConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RepositoryEventConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RepositoryEventConfig + * @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.RepositoryEventConfig; + + /** + * Decodes a RepositoryEventConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RepositoryEventConfig + * @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.RepositoryEventConfig; + + /** + * Verifies a RepositoryEventConfig 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 RepositoryEventConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RepositoryEventConfig + */ + public static fromObject(object: { [k: string]: any }): google.devtools.cloudbuild.v1.RepositoryEventConfig; + + /** + * Creates a plain object from a RepositoryEventConfig message. Also converts values to other types if specified. + * @param message RepositoryEventConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.cloudbuild.v1.RepositoryEventConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RepositoryEventConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RepositoryEventConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RepositoryEventConfig { + + /** RepositoryType enum. */ + enum RepositoryType { + REPOSITORY_TYPE_UNSPECIFIED = 0, + GITHUB = 1, + GITHUB_ENTERPRISE = 2, + GITLAB_ENTERPRISE = 3 + } + } + /** Properties of a GitHubEventsConfig. */ interface IGitHubEventsConfig { diff --git a/packages/google-devtools-cloudbuild/protos/protos.js b/packages/google-devtools-cloudbuild/protos/protos.js index ae9dd2f4819..10c47196c86 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.js +++ b/packages/google-devtools-cloudbuild/protos/protos.js @@ -13448,6 +13448,7 @@ * @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 */ /** @@ -13621,6 +13622,14 @@ */ 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; @@ -13701,6 +13710,8 @@ 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; }; @@ -13836,6 +13847,10 @@ 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; @@ -13969,6 +13984,11 @@ 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; }; @@ -14060,6 +14080,11 @@ 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); + } return message; }; @@ -14096,6 +14121,7 @@ object.webhookConfig = null; object.serviceAccount = ""; object.resourceName = ""; + object.repositoryEventConfig = null; } if (message.id != null && message.hasOwnProperty("id")) object.id = message.id; @@ -14157,6 +14183,8 @@ 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; }; @@ -14189,6 +14217,363 @@ return BuildTrigger; })(); + v1.RepositoryEventConfig = (function() { + + /** + * Properties of a RepositoryEventConfig. + * @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 + */ + + /** + * Constructs a new RepositoryEventConfig. + * @memberof google.devtools.cloudbuild.v1 + * @classdesc Represents a RepositoryEventConfig. + * @implements IRepositoryEventConfig + * @constructor + * @param {google.devtools.cloudbuild.v1.IRepositoryEventConfig=} [properties] Properties to set + */ + function RepositoryEventConfig(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]]; + } + + /** + * RepositoryEventConfig repository. + * @member {string} repository + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance + */ + RepositoryEventConfig.prototype.repository = ""; + + /** + * RepositoryEventConfig repositoryType. + * @member {google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType} repositoryType + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance + */ + RepositoryEventConfig.prototype.repositoryType = 0; + + /** + * RepositoryEventConfig pullRequest. + * @member {google.devtools.cloudbuild.v1.IPullRequestFilter|null|undefined} pullRequest + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance + */ + RepositoryEventConfig.prototype.pullRequest = null; + + /** + * RepositoryEventConfig push. + * @member {google.devtools.cloudbuild.v1.IPushFilter|null|undefined} push + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance + */ + RepositoryEventConfig.prototype.push = 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 + * @instance + */ + 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 RepositoryEventConfig message. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * @function encode + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @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 + */ + RepositoryEventConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + 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 RepositoryEventConfig message, length delimited. Does not implicitly {@link google.devtools.cloudbuild.v1.RepositoryEventConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @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 + */ + RepositoryEventConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RepositoryEventConfig message from the specified reader or buffer. + * @function decode + * @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.RepositoryEventConfig} RepositoryEventConfig + * @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) { + 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(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.repository = reader.string(); + break; + } + case 2: { + message.repositoryType = reader.int32(); + break; + } + case 3: { + message.pullRequest = $root.google.devtools.cloudbuild.v1.PullRequestFilter.decode(reader, reader.uint32()); + break; + } + case 4: { + message.push = $root.google.devtools.cloudbuild.v1.PushFilter.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RepositoryEventConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + RepositoryEventConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RepositoryEventConfig message. + * @function verify + * @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 + */ + RepositoryEventConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + 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 "repositoryType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + 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 RepositoryEventConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.cloudbuild.v1.RepositoryEventConfig} RepositoryEventConfig + */ + RepositoryEventConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.cloudbuild.v1.RepositoryEventConfig) + return object; + 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.repositoryType === "number") { + message.repositoryType = object.repositoryType; + break; + } + break; + case "REPOSITORY_TYPE_UNSPECIFIED": + case 0: + message.repositoryType = 0; + break; + case "GITHUB": + case 1: + message.repositoryType = 1; + break; + case "GITHUB_ENTERPRISE": + case 2: + message.repositoryType = 2; + break; + case "GITLAB_ENTERPRISE": + case 3: + 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 RepositoryEventConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @param {google.devtools.cloudbuild.v1.RepositoryEventConfig} message RepositoryEventConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RepositoryEventConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + 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"; + } + return object; + }; + + /** + * Converts this RepositoryEventConfig to JSON. + * @function toJSON + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @instance + * @returns {Object.} JSON object + */ + RepositoryEventConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RepositoryEventConfig + * @function getTypeUrl + * @memberof google.devtools.cloudbuild.v1.RepositoryEventConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RepositoryEventConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.cloudbuild.v1.RepositoryEventConfig"; + }; + + /** + * RepositoryType enum. + * @name google.devtools.cloudbuild.v1.RepositoryEventConfig.RepositoryType + * @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 + */ + RepositoryEventConfig.RepositoryType = (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; + return values; + })(); + + return RepositoryEventConfig; + })(); + v1.GitHubEventsConfig = (function() { /** diff --git a/packages/google-devtools-cloudbuild/protos/protos.json b/packages/google-devtools-cloudbuild/protos/protos.json index 882b0894c55..1f9c416c0ce 100644 --- a/packages/google-devtools-cloudbuild/protos/protos.json +++ b/packages/google-devtools-cloudbuild/protos/protos.json @@ -15,8 +15,8 @@ "objc_class_prefix": "GCB", "php_namespace": "Google\\Cloud\\Build\\V1", "ruby_package": "Google::Cloud::Build::V1", - "(google.api.resource_definition).type": "pubsub.googleapis.com/Topic", - "(google.api.resource_definition).pattern": "projects/{project}/topics/{topic}" + "(google.api.resource_definition).type": "cloudbuild.googleapis.com/Repository", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" }, "nested": { "CloudBuild": { @@ -1716,6 +1716,54 @@ "options": { "(google.api.resource_reference).type": "iam.googleapis.com/ServiceAccount" } + }, + "repositoryEventConfig": { + "type": "RepositoryEventConfig", + "id": 39 + } + } + }, + "RepositoryEventConfig": { + "oneofs": { + "filter": { + "oneof": [ + "pullRequest", + "push" + ] + } + }, + "fields": { + "repository": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Repository" + } + }, + "repositoryType": { + "type": "RepositoryType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "pullRequest": { + "type": "PullRequestFilter", + "id": 3 + }, + "push": { + "type": "PushFilter", + "id": 4 + } + }, + "nested": { + "RepositoryType": { + "values": { + "REPOSITORY_TYPE_UNSPECIFIED": 0, + "GITHUB": 1, + "GITHUB_ENTERPRISE": 2, + "GITLAB_ENTERPRISE": 3 + } } } }, 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 69483b1b259..89d357e6870 100644 --- a/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts +++ b/packages/google-devtools-cloudbuild/src/v1/cloud_build_client.ts @@ -209,6 +209,9 @@ export class CloudBuildClient { 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}' ), @@ -3350,6 +3353,77 @@ export class CloudBuildClient { ).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. * 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 cd0369a7946..e2e8369f5d9 100644 --- a/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts +++ b/packages/google-devtools-cloudbuild/test/gapic_cloud_build_v1.ts @@ -4470,6 +4470,82 @@ describe('v1.CloudBuildClient', () => { }); }); + 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 = {