From 94cf0042b7e886ba0123f728957d5560f85e4d8c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 6 Dec 2022 19:52:58 +0000 Subject: [PATCH 1/2] feat: publishing TPU v2 API fix!: fix incorrect resource annotations for TPU v2alpha1 API PiperOrigin-RevId: 493327922 Source-Link: https://github.com/googleapis/googleapis/commit/93c3e0eb6b4a4063daa4c9f89c488058699efe2b Source-Link: https://github.com/googleapis/googleapis-gen/commit/4c018988e3571df80cde7923a1e6209fcf9197c7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRwdS8uT3dsQm90LnlhbWwiLCJoIjoiNGMwMTg5ODhlMzU3MWRmODBjZGU3OTIzYTFlNjIwOWZjZjkxOTdjNyJ9 --- .../google-cloud-tpu/v1/.eslintignore | 7 + .../google-cloud-tpu/v1/.eslintrc.json | 3 + .../google-cloud-tpu/v1/.gitignore | 14 + owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js | 55 + .../google-cloud-tpu/v1/.mocharc.js | 33 + .../google-cloud-tpu/v1/.prettierrc.js | 22 + owl-bot-staging/google-cloud-tpu/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../google-cloud-tpu/v1/package.json | 64 + .../google/cloud/tpu/v1/cloud_tpu.proto | 617 +++ .../snippet_metadata.google.cloud.tpu.v1.json | 507 +++ .../samples/generated/v1/tpu.create_node.js | 71 + .../samples/generated/v1/tpu.delete_node.js | 62 + .../generated/v1/tpu.get_accelerator_type.js | 61 + .../v1/samples/generated/v1/tpu.get_node.js | 61 + .../v1/tpu.get_tensor_flow_version.js | 61 + .../v1/tpu.list_accelerator_types.js | 79 + .../v1/samples/generated/v1/tpu.list_nodes.js | 71 + .../v1/tpu.list_tensor_flow_versions.js | 79 + .../samples/generated/v1/tpu.reimage_node.js | 65 + .../v1/samples/generated/v1/tpu.start_node.js | 61 + .../v1/samples/generated/v1/tpu.stop_node.js | 61 + .../google-cloud-tpu/v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 145 + .../google-cloud-tpu/v1/src/v1/index.ts | 19 + .../google-cloud-tpu/v1/src/v1/tpu_client.ts | 2094 +++++++++ .../v1/src/v1/tpu_client_config.json | 81 + .../v1/src/v1/tpu_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../google-cloud-tpu/v1/test/gapic_tpu_v1.ts | 2672 ++++++++++++ .../google-cloud-tpu/v1/tsconfig.json | 19 + .../google-cloud-tpu/v1/webpack.config.js | 64 + .../google-cloud-tpu/v2/.eslintignore | 7 + .../google-cloud-tpu/v2/.eslintrc.json | 3 + .../google-cloud-tpu/v2/.gitignore | 14 + owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js | 55 + .../google-cloud-tpu/v2/.mocharc.js | 33 + .../google-cloud-tpu/v2/.prettierrc.js | 22 + owl-bot-staging/google-cloud-tpu/v2/README.md | 1 + .../v2/linkinator.config.json | 16 + .../google-cloud-tpu/v2/package.json | 64 + .../google/cloud/tpu/v2/cloud_tpu.proto | 795 ++++ .../snippet_metadata.google.cloud.tpu.v2.json | 595 +++ .../samples/generated/v2/tpu.create_node.js | 71 + .../samples/generated/v2/tpu.delete_node.js | 62 + .../v2/tpu.generate_service_identity.js | 61 + .../generated/v2/tpu.get_accelerator_type.js | 61 + .../generated/v2/tpu.get_guest_attributes.js | 70 + .../v2/samples/generated/v2/tpu.get_node.js | 61 + .../generated/v2/tpu.get_runtime_version.js | 61 + .../v2/tpu.list_accelerator_types.js | 79 + .../v2/samples/generated/v2/tpu.list_nodes.js | 71 + .../generated/v2/tpu.list_runtime_versions.js | 79 + .../v2/samples/generated/v2/tpu.start_node.js | 62 + .../v2/samples/generated/v2/tpu.stop_node.js | 62 + .../samples/generated/v2/tpu.update_node.js | 69 + .../google-cloud-tpu/v2/src/index.ts | 25 + .../v2/src/v2/gapic_metadata.json | 165 + .../google-cloud-tpu/v2/src/v2/index.ts | 19 + .../google-cloud-tpu/v2/src/v2/tpu_client.ts | 2249 ++++++++++ .../v2/src/v2/tpu_client_config.json | 91 + .../v2/src/v2/tpu_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2/system-test/install.ts | 49 + .../google-cloud-tpu/v2/test/gapic_tpu_v2.ts | 2892 +++++++++++++ .../google-cloud-tpu/v2/tsconfig.json | 19 + .../google-cloud-tpu/v2/webpack.config.js | 64 + .../google-cloud-tpu/v2alpha1/.eslintignore | 7 + .../google-cloud-tpu/v2alpha1/.eslintrc.json | 3 + .../google-cloud-tpu/v2alpha1/.gitignore | 14 + .../google-cloud-tpu/v2alpha1/.jsdoc.js | 55 + .../google-cloud-tpu/v2alpha1/.mocharc.js | 33 + .../google-cloud-tpu/v2alpha1/.prettierrc.js | 22 + .../google-cloud-tpu/v2alpha1/README.md | 1 + .../v2alpha1/linkinator.config.json | 16 + .../google-cloud-tpu/v2alpha1/package.json | 64 + .../google/cloud/tpu/v2alpha1/cloud_tpu.proto | 1169 +++++ ...et_metadata.google.cloud.tpu.v2alpha1.json | 831 ++++ .../generated/v2alpha1/tpu.create_node.js | 75 + .../v2alpha1/tpu.create_queued_resource.js | 76 + .../generated/v2alpha1/tpu.delete_node.js | 66 + .../v2alpha1/tpu.delete_queued_resource.js | 66 + .../v2alpha1/tpu.generate_service_identity.js | 61 + .../v2alpha1/tpu.get_accelerator_type.js | 61 + .../v2alpha1/tpu.get_guest_attributes.js | 70 + .../generated/v2alpha1/tpu.get_node.js | 61 + .../v2alpha1/tpu.get_queued_resource.js | 61 + .../v2alpha1/tpu.get_runtime_version.js | 61 + .../v2alpha1/tpu.list_accelerator_types.js | 79 + .../generated/v2alpha1/tpu.list_nodes.js | 71 + .../v2alpha1/tpu.list_queued_resources.js | 71 + .../v2alpha1/tpu.list_runtime_versions.js | 79 + .../tpu.simulate_maintenance_event.js | 69 + .../generated/v2alpha1/tpu.start_node.js | 62 + .../generated/v2alpha1/tpu.stop_node.js | 62 + .../generated/v2alpha1/tpu.update_node.js | 69 + .../google-cloud-tpu/v2alpha1/src/index.ts | 25 + .../v2alpha1/src/v2alpha1/gapic_metadata.json | 219 + .../v2alpha1/src/v2alpha1/index.ts | 19 + .../v2alpha1/src/v2alpha1/tpu_client.ts | 2862 +++++++++++++ .../src/v2alpha1/tpu_client_config.json | 116 + .../v2alpha1/src/v2alpha1/tpu_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v2alpha1/system-test/install.ts | 49 + .../v2alpha1/test/gapic_tpu_v2alpha1.ts | 3753 +++++++++++++++++ .../google-cloud-tpu/v2alpha1/tsconfig.json | 19 + .../v2alpha1/webpack.config.js | 64 + 111 files changed, 26033 insertions(+) create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/README.md create mode 100644 owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/package.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-tpu/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.gitignore create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/README.md create mode 100644 owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/package.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/README.md create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/package.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-tpu/v1/.eslintignore b/owl-bot-staging/google-cloud-tpu/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/.gitignore b/owl-bot-staging/google-cloud-tpu/v1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js new file mode 100644 index 00000000000..5b3c57ae725 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/tpu', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/README.md b/owl-bot-staging/google-cloud-tpu/v1/README.md new file mode 100644 index 00000000000..b04db0dc280 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/README.md @@ -0,0 +1 @@ +Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/package.json b/owl-bot-staging/google-cloud-tpu/v1/package.json new file mode 100644 index 00000000000..911441f5cee --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/tpu", + "version": "0.1.0", + "description": "Tpu client for Node.js", + "repository": "googleapis/nodejs-tpu", + "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 tpu", + "tpu", + "tpu" + ], + "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.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto b/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto new file mode 100644 index 00000000000..c2acf92f439 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto @@ -0,0 +1,617 @@ +// 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.cloud.tpu.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v1;tpu"; +option java_multiple_files = true; +option java_outer_classname = "CloudTpuProto"; +option java_package = "com.google.cloud.tpu.v1"; + +// Manages TPU nodes and other resources +// +// TPU API v1 +service Tpu { + option (google.api.default_host) = "tpu.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists nodes. + rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/nodes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a node. + rpc GetNode(GetNodeRequest) returns (Node) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a node. + rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/nodes" + body: "node" + }; + option (google.api.method_signature) = "parent,node,node_id"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a node. + rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Reimages a node's OS. + rpc ReimageNode(ReimageNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/nodes/*}:reimage" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Stops a node, this operation is only available with single TPU nodes. + rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/nodes/*}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Starts a node. + rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/nodes/*}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // List TensorFlow versions supported by this API. + rpc ListTensorFlowVersions(ListTensorFlowVersionsRequest) returns (ListTensorFlowVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/tensorflowVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets TensorFlow Version. + rpc GetTensorFlowVersion(GetTensorFlowVersionRequest) returns (TensorFlowVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/tensorflowVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists accelerator types supported by this API. + rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/acceleratorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets AcceleratorType. + rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/acceleratorTypes/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Sets the scheduling options for this node. +message SchedulingConfig { + // Defines whether the node is preemptible. + bool preemptible = 1; + + // Whether the node is created under a reservation. + bool reserved = 2; +} + +// A network endpoint over which a TPU worker can be reached. +message NetworkEndpoint { + // The IP address of this network endpoint. + string ip_address = 1; + + // The port of this network endpoint. + int32 port = 2; +} + +// A TPU instance. +message Node { + option (google.api.resource) = { + type: "tpu.googleapis.com/Node" + pattern: "projects/{project}/locations/{location}/nodes/{node}" + }; + + // Represents the different states of a TPU node during its lifecycle. + enum State { + // TPU node state is not known/set. + STATE_UNSPECIFIED = 0; + + // TPU node is being created. + CREATING = 1; + + // TPU node has been created. + READY = 2; + + // TPU node is restarting. + RESTARTING = 3; + + // TPU node is undergoing reimaging. + REIMAGING = 4; + + // TPU node is being deleted. + DELETING = 5; + + // TPU node is being repaired and may be unusable. Details can be + // found in the `help_description` field. + REPAIRING = 6; + + // TPU node is stopped. + STOPPED = 8; + + // TPU node is currently stopping. + STOPPING = 9; + + // TPU node is currently starting. + STARTING = 10; + + // TPU node has been preempted. Only applies to Preemptible TPU Nodes. + PREEMPTED = 11; + + // TPU node has been terminated due to maintenance or has reached the end of + // its life cycle (for preemptible nodes). + TERMINATED = 12; + + // TPU node is currently hiding. + HIDING = 13; + + // TPU node has been hidden. + HIDDEN = 14; + + // TPU node is currently unhiding. + UNHIDING = 15; + } + + // Health defines the status of a TPU node as reported by + // Health Monitor. + enum Health { + // Health status is unknown: not initialized or failed to retrieve. + HEALTH_UNSPECIFIED = 0; + + // The resource is healthy. + HEALTHY = 1; + + // The resource is unhealthy. + DEPRECATED_UNHEALTHY = 2; + + // The resource is unresponsive. + TIMEOUT = 3; + + // The in-guest ML stack is unhealthy. + UNHEALTHY_TENSORFLOW = 4; + + // The node is under maintenance/priority boost caused rescheduling and + // will resume running once rescheduled. + UNHEALTHY_MAINTENANCE = 5; + } + + // TPU API Version. + enum ApiVersion { + // API version is unknown. + API_VERSION_UNSPECIFIED = 0; + + // TPU API V1Alpha1 version. + V1_ALPHA1 = 1; + + // TPU API V1 version. + V1 = 2; + + // TPU API V2Alpha1 version. + V2_ALPHA1 = 3; + } + + // Output only. Immutable. The name of the TPU + string name = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // The user-supplied description of the TPU. Maximum of 512 characters. + string description = 3; + + // Required. The type of hardware accelerators associated with this node. + string accelerator_type = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. DEPRECATED! Use network_endpoints instead. + // The network address for the TPU Node as visible to Compute Engine + // instances. + string ip_address = 8 [deprecated = true]; + + // Output only. DEPRECATED! Use network_endpoints instead. + // The network port for the TPU Node as visible to Compute Engine instances. + string port = 14 [deprecated = true]; + + // Output only. The current state for the TPU Node. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If this field is populated, it contains a description of why the TPU Node + // is unhealthy. + string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The version of Tensorflow running in the Node. + string tensorflow_version = 11 [(google.api.field_behavior) = REQUIRED]; + + // The name of a network they wish to peer the TPU node to. It must be a + // preexisting Compute Engine network inside of the project on which this API + // has been activated. If none is provided, "default" will be used. + string network = 12; + + // The CIDR block that the TPU node will use when selecting an IP address. + // This CIDR block must be a /29 block; the Compute Engine networks API + // forbids a smaller block, and using a larger block would be wasteful (a + // node can only consume one IP address). Errors will occur if the CIDR block + // has already been used for a currently existing TPU node, the CIDR block + // conflicts with any subnetworks in the user's provided network, or the + // provided network is peered with another network that is using that CIDR + // block. + string cidr_block = 13; + + // Output only. The service account used to run the tensor flow services within the node. + // To share resources, including Google Cloud Storage data, with the + // Tensorflow job running in the Node, this account must have permissions to + // that data. + string service_account = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the node was created. + google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The scheduling options for this node. + SchedulingConfig scheduling_config = 17; + + // Output only. The network endpoints where TPU workers can be accessed and + // sent work. It is recommended that Tensorflow clients of the node reach out + // to the 0th entry in this map first. + repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The health status of the TPU node. + Health health = 22; + + // Resource labels to represent user-provided metadata. + map labels = 24; + + // Whether the VPC peering for the node is set up through Service Networking + // API. The VPC Peering should be set up before provisioning the node. + // If this field is set, cidr_block field should not be specified. If the + // network, that you want to peer the TPU Node to, is Shared VPC networks, + // the node must be created with this this field enabled. + bool use_service_networking = 27; + + // Output only. The API version that created this Node. + ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Symptoms that have occurred to the TPU Node. + repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [ListNodes][google.cloud.tpu.v1.Tpu.ListNodes]. +message ListNodesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Node" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListNodes][google.cloud.tpu.v1.Tpu.ListNodes]. +message ListNodesResponse { + // The listed nodes. + repeated Node nodes = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetNode][google.cloud.tpu.v1.Tpu.GetNode]. +message GetNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [CreateNode][google.cloud.tpu.v1.Tpu.CreateNode]. +message CreateNodeRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Node" + } + ]; + + // The unqualified resource name. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [DeleteNode][google.cloud.tpu.v1.Tpu.DeleteNode]. +message DeleteNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [ReimageNode][google.cloud.tpu.v1.Tpu.ReimageNode]. +message ReimageNodeRequest { + // The resource name. + string name = 1; + + // The version for reimage to create. + string tensorflow_version = 2; +} + +// Request for [StopNode][google.cloud.tpu.v1.Tpu.StopNode]. +message StopNodeRequest { + // The resource name. + string name = 1; +} + +// Request for [StartNode][google.cloud.tpu.v1.Tpu.StartNode]. +message StartNodeRequest { + // The resource name. + string name = 1; +} + +// A tensorflow version that a Node can be configured with. +message TensorFlowVersion { + option (google.api.resource) = { + type: "tpu.googleapis.com/TensorFlowVersion" + pattern: "projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}" + }; + + // The resource name. + string name = 1; + + // the tensorflow version. + string version = 2; +} + +// Request for [GetTensorFlowVersion][google.cloud.tpu.v1.Tpu.GetTensorFlowVersion]. +message GetTensorFlowVersionRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/TensorFlowVersion" + } + ]; +} + +// Request for [ListTensorFlowVersions][google.cloud.tpu.v1.Tpu.ListTensorFlowVersions]. +message ListTensorFlowVersionsRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/TensorFlowVersion" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListTensorFlowVersions][google.cloud.tpu.v1.Tpu.ListTensorFlowVersions]. +message ListTensorFlowVersionsResponse { + // The listed nodes. + repeated TensorFlowVersion tensorflow_versions = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A accelerator type that a Node can be configured with. +message AcceleratorType { + option (google.api.resource) = { + type: "tpu.googleapis.com/AcceleratorType" + pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }; + + // The resource name. + string name = 1; + + // the accelerator type. + string type = 2; +} + +// Request for [GetAcceleratorType][google.cloud.tpu.v1.Tpu.GetAcceleratorType]. +message GetAcceleratorTypeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; +} + +// Request for [ListAcceleratorTypes][google.cloud.tpu.v1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListAcceleratorTypes][google.cloud.tpu.v1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesResponse { + // The listed nodes. + repeated AcceleratorType accelerator_types = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} + +// A Symptom instance. +message Symptom { + // SymptomType represents the different types of Symptoms that a TPU can be + // at. + enum SymptomType { + // Unspecified symptom. + SYMPTOM_TYPE_UNSPECIFIED = 0; + + // TPU VM memory is low. + LOW_MEMORY = 1; + + // TPU runtime is out of memory. + OUT_OF_MEMORY = 2; + + // TPU runtime execution has timed out. + EXECUTE_TIMED_OUT = 3; + + // TPU runtime fails to construct a mesh that recognizes each TPU device's + // neighbors. + MESH_BUILD_FAIL = 4; + + // TPU HBM is out of memory. + HBM_OUT_OF_MEMORY = 5; + + // Abusive behaviors have been identified on the current project. + PROJECT_ABUSE = 6; + } + + // Timestamp when the Symptom is created. + google.protobuf.Timestamp create_time = 1; + + // Type of the Symptom. + SymptomType symptom_type = 2; + + // Detailed information of the current Symptom. + string details = 3; + + // A string used to uniquely distinguish a worker within a TPU node. + string worker_id = 4; +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json new file mode 100644 index 00000000000..749983cd917 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json @@ -0,0 +1,507 @@ +{ + "clientLibrary": { + "name": "nodejs-tpu", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.tpu.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "tpu_v1_generated_Tpu_ListNodes_async", + "title": "Tpu listNodes Sample", + "origin": "API_DEFINITION", + "description": " Lists nodes.", + "canonical": true, + "file": "tpu.list_nodes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v1.Tpu.ListNodes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.ListNodesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v1.Tpu.ListNodes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_GetNode_async", + "title": "Tpu getNode Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a node.", + "canonical": true, + "file": "tpu.get_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v1.Tpu.GetNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.Node", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v1.Tpu.GetNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_CreateNode_async", + "title": "Tpu createNode Sample", + "origin": "API_DEFINITION", + "description": " Creates a node.", + "canonical": true, + "file": "tpu.create_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v1.Tpu.CreateNode", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "node_id", + "type": "TYPE_STRING" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v1.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v1.Tpu.CreateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_DeleteNode_async", + "title": "Tpu deleteNode Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node.", + "canonical": true, + "file": "tpu.delete_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v1.Tpu.DeleteNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v1.Tpu.DeleteNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_ReimageNode_async", + "title": "Tpu reimageNode Sample", + "origin": "API_DEFINITION", + "description": " Reimages a node's OS.", + "canonical": true, + "file": "tpu.reimage_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReimageNode", + "fullName": "google.cloud.tpu.v1.Tpu.ReimageNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "tensorflow_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "ReimageNode", + "fullName": "google.cloud.tpu.v1.Tpu.ReimageNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_StopNode_async", + "title": "Tpu stopNode Sample", + "origin": "API_DEFINITION", + "description": " Stops a node, this operation is only available with single TPU nodes.", + "canonical": true, + "file": "tpu.stop_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v1.Tpu.StopNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v1.Tpu.StopNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_StartNode_async", + "title": "Tpu startNode Sample", + "origin": "API_DEFINITION", + "description": " Starts a node.", + "canonical": true, + "file": "tpu.start_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v1.Tpu.StartNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v1.Tpu.StartNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_ListTensorFlowVersions_async", + "title": "Tpu listTensorFlowVersions Sample", + "origin": "API_DEFINITION", + "description": " List TensorFlow versions supported by this API.", + "canonical": true, + "file": "tpu.list_tensor_flow_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListTensorFlowVersions", + "fullName": "google.cloud.tpu.v1.Tpu.ListTensorFlowVersions", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.ListTensorFlowVersionsResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "ListTensorFlowVersions", + "fullName": "google.cloud.tpu.v1.Tpu.ListTensorFlowVersions", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_GetTensorFlowVersion_async", + "title": "Tpu getTensorFlowVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets TensorFlow Version.", + "canonical": true, + "file": "tpu.get_tensor_flow_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetTensorFlowVersion", + "fullName": "google.cloud.tpu.v1.Tpu.GetTensorFlowVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.TensorFlowVersion", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "GetTensorFlowVersion", + "fullName": "google.cloud.tpu.v1.Tpu.GetTensorFlowVersion", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_ListAcceleratorTypes_async", + "title": "Tpu listAcceleratorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists accelerator types supported by this API.", + "canonical": true, + "file": "tpu.list_accelerator_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v1.Tpu.ListAcceleratorTypes", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.ListAcceleratorTypesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v1.Tpu.ListAcceleratorTypes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v1_generated_Tpu_GetAcceleratorType_async", + "title": "Tpu getAcceleratorType Sample", + "origin": "API_DEFINITION", + "description": " Gets AcceleratorType.", + "canonical": true, + "file": "tpu.get_accelerator_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v1.Tpu.GetAcceleratorType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v1.AcceleratorType", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v1.TpuClient" + }, + "method": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v1.Tpu.GetAcceleratorType", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v1.Tpu" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js new file mode 100644 index 00000000000..35fcf2bec3a --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, node) { + // [START tpu_v1_generated_Tpu_CreateNode_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 name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. + */ + // const nodeId = 'abc123' + /** + * Required. The node. + */ + // const node = {} + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callCreateNode() { + // Construct request + const request = { + parent, + node, + }; + + // Run request + const [operation] = await tpuClient.createNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateNode(); + // [END tpu_v1_generated_Tpu_CreateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js new file mode 100644 index 00000000000..ad364cdbb8a --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_DeleteNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callDeleteNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteNode(); + // [END tpu_v1_generated_Tpu_DeleteNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js new file mode 100644 index 00000000000..b2e8afbdd48 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetAcceleratorType_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetAcceleratorType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getAcceleratorType(request); + console.log(response); + } + + callGetAcceleratorType(); + // [END tpu_v1_generated_Tpu_GetAcceleratorType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js new file mode 100644 index 00000000000..70b0c8ff589 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetNode() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getNode(request); + console.log(response); + } + + callGetNode(); + // [END tpu_v1_generated_Tpu_GetNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js new file mode 100644 index 00000000000..479389099cd --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v1_generated_Tpu_GetTensorFlowVersion_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetTensorFlowVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getTensorFlowVersion(request); + console.log(response); + } + + callGetTensorFlowVersion(); + // [END tpu_v1_generated_Tpu_GetTensorFlowVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js new file mode 100644 index 00000000000..9458a1aef12 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListAcceleratorTypes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListAcceleratorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listAcceleratorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAcceleratorTypes(); + // [END tpu_v1_generated_Tpu_ListAcceleratorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js new file mode 100644 index 00000000000..c7165073b90 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListNodes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListNodes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listNodesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNodes(); + // [END tpu_v1_generated_Tpu_ListNodes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js new file mode 100644 index 00000000000..6884855a885 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v1_generated_Tpu_ListTensorFlowVersions_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListTensorFlowVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listTensorFlowVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTensorFlowVersions(); + // [END tpu_v1_generated_Tpu_ListTensorFlowVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js new file mode 100644 index 00000000000..5963a05144d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_ReimageNode_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 resource name. + */ + // const name = 'abc123' + /** + * The version for reimage to create. + */ + // const tensorflowVersion = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callReimageNode() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await tpuClient.reimageNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReimageNode(); + // [END tpu_v1_generated_Tpu_ReimageNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js new file mode 100644 index 00000000000..61d31d20b5a --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_StartNode_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 resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStartNode() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await tpuClient.startNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartNode(); + // [END tpu_v1_generated_Tpu_StartNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js new file mode 100644 index 00000000000..e3b7891529f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START tpu_v1_generated_Tpu_StopNode_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 resource name. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStopNode() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await tpuClient.stopNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopNode(); + // [END tpu_v1_generated_Tpu_StopNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/index.ts b/owl-bot-staging/google-cloud-tpu/v1/src/index.ts new file mode 100644 index 00000000000..5dedc6879ab --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const TpuClient = v1.TpuClient; +type TpuClient = v1.TpuClient; +export {v1, TpuClient}; +export default {v1, TpuClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..b15f377b942 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json @@ -0,0 +1,145 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.tpu.v1", + "libraryPackage": "@google-cloud/tpu", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GetTensorFlowVersion": { + "methods": [ + "getTensorFlowVersion" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "ReimageNode": { + "methods": [ + "reimageNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListTensorFlowVersions": { + "methods": [ + "listTensorFlowVersions", + "listTensorFlowVersionsStream", + "listTensorFlowVersionsAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GetTensorFlowVersion": { + "methods": [ + "getTensorFlowVersion" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "ReimageNode": { + "methods": [ + "reimageNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListTensorFlowVersions": { + "methods": [ + "listTensorFlowVersions", + "listTensorFlowVersionsStream", + "listTensorFlowVersionsAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts new file mode 100644 index 00000000000..27c81814923 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {TpuClient} from './tpu_client'; diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts new file mode 100644 index 00000000000..7e15e54301f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts @@ -0,0 +1,2094 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/v1/tpu_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tpu_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages TPU nodes and other resources + * + * TPU API v1 + * @class + * @memberof v1 + */ +export class TpuClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tpuStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TpuClient. + * + * @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 TpuClient({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 TpuClient; + 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.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 = { + acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodes/{node}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + tensorFlowVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}' + ), + }; + + // 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 = { + listNodes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), + listTensorFlowVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tensorflowVersions'), + listAcceleratorTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes') + }; + + 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.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; + const createNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; + const deleteNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; + const deleteNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; + const reimageNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; + const reimageNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; + const stopNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; + const stopNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; + const startNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; + const startNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeResponse.decode.bind(createNodeResponse), + createNodeMetadata.decode.bind(createNodeMetadata)), + deleteNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNodeResponse.decode.bind(deleteNodeResponse), + deleteNodeMetadata.decode.bind(deleteNodeMetadata)), + reimageNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reimageNodeResponse.decode.bind(reimageNodeResponse), + reimageNodeMetadata.decode.bind(reimageNodeMetadata)), + stopNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopNodeResponse.decode.bind(stopNodeResponse), + stopNodeMetadata.decode.bind(stopNodeMetadata)), + startNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startNodeResponse.decode.bind(startNodeResponse), + startNodeMetadata.decode.bind(startNodeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.tpu.v1.Tpu', 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.tpuStub) { + return this.tpuStub; + } + + // Put together the "service stub" for + // google.cloud.tpu.v1.Tpu. + this.tpuStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v1.Tpu') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.tpu.v1.Tpu, + 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 tpuStubMethods = + ['listNodes', 'getNode', 'createNode', 'deleteNode', 'reimageNode', 'stopNode', 'startNode', 'listTensorFlowVersions', 'getTensorFlowVersion', 'listAcceleratorTypes', 'getAcceleratorType']; + for (const methodName of tpuStubMethods) { + const callPromise = this.tpuStub.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.tpuStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'tpu.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 'tpu.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 the details of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [Node]{@link google.cloud.tpu.v1.Node}. + * 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/tpu.get_node.js + * region_tag:tpu_v1_generated_Tpu_GetNode_async + */ + getNode( + request?: protos.google.cloud.tpu.v1.IGetNodeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|undefined, {}|undefined + ]>; + getNode( + request: protos.google.cloud.tpu.v1.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request: protos.google.cloud.tpu.v1.IGetNodeRequest, + callback: Callback< + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request?: protos.google.cloud.tpu.v1.IGetNodeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v1.INode, + protos.google.cloud.tpu.v1.IGetNodeRequest|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.getNode(request, options, callback); + } +/** + * Gets TensorFlow Version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. + * 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/tpu.get_tensor_flow_version.js + * region_tag:tpu_v1_generated_Tpu_GetTensorFlowVersion_async + */ + getTensorFlowVersion( + request?: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|undefined, {}|undefined + ]>; + getTensorFlowVersion( + request: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, + {}|null|undefined>): void; + getTensorFlowVersion( + request: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, + callback: Callback< + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, + {}|null|undefined>): void; + getTensorFlowVersion( + request?: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v1.ITensorFlowVersion, + protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|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.getTensorFlowVersion(request, options, callback); + } +/** + * Gets AcceleratorType. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. + * 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/tpu.get_accelerator_type.js + * region_tag:tpu_v1_generated_Tpu_GetAcceleratorType_async + */ + getAcceleratorType( + request?: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|undefined, {}|undefined + ]>; + getAcceleratorType( + request: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, + callback: Callback< + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request?: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v1.IAcceleratorType, + protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); + } + +/** + * Creates a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.nodeId + * The unqualified resource name. + * @param {google.cloud.tpu.v1.Node} request.node + * Required. The node. + * @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/tpu.create_node.js + * region_tag:tpu_v1_generated_Tpu_CreateNode_async + */ + createNode( + request?: protos.google.cloud.tpu.v1.ICreateNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createNode( + request: protos.google.cloud.tpu.v1.ICreateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request: protos.google.cloud.tpu.v1.ICreateNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request?: protos.google.cloud.tpu.v1.ICreateNodeRequest, + 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.createNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createNode()`. + * @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/tpu.create_node.js + * region_tag:tpu_v1_generated_Tpu_CreateNode_async + */ + async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.delete_node.js + * region_tag:tpu_v1_generated_Tpu_DeleteNode_async + */ + deleteNode( + request?: protos.google.cloud.tpu.v1.IDeleteNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteNode( + request: protos.google.cloud.tpu.v1.IDeleteNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request: protos.google.cloud.tpu.v1.IDeleteNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request?: protos.google.cloud.tpu.v1.IDeleteNodeRequest, + 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.deleteNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteNode()`. + * @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/tpu.delete_node.js + * region_tag:tpu_v1_generated_Tpu_DeleteNode_async + */ + async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Reimages a node's OS. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource name. + * @param {string} request.tensorflowVersion + * The version for reimage 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/tpu.reimage_node.js + * region_tag:tpu_v1_generated_Tpu_ReimageNode_async + */ + reimageNode( + request?: protos.google.cloud.tpu.v1.IReimageNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + reimageNode( + request: protos.google.cloud.tpu.v1.IReimageNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reimageNode( + request: protos.google.cloud.tpu.v1.IReimageNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + reimageNode( + request?: protos.google.cloud.tpu.v1.IReimageNodeRequest, + 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.reimageNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `reimageNode()`. + * @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/tpu.reimage_node.js + * region_tag:tpu_v1_generated_Tpu_ReimageNode_async + */ + async checkReimageNodeProgress(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.reimageNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops a node, this operation is only available with single TPU nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource name. + * @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/tpu.stop_node.js + * region_tag:tpu_v1_generated_Tpu_StopNode_async + */ + stopNode( + request?: protos.google.cloud.tpu.v1.IStopNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopNode( + request: protos.google.cloud.tpu.v1.IStopNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request: protos.google.cloud.tpu.v1.IStopNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request?: protos.google.cloud.tpu.v1.IStopNodeRequest, + 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.stopNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopNode()`. + * @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/tpu.stop_node.js + * region_tag:tpu_v1_generated_Tpu_StopNode_async + */ + async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource name. + * @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/tpu.start_node.js + * region_tag:tpu_v1_generated_Tpu_StartNode_async + */ + startNode( + request?: protos.google.cloud.tpu.v1.IStartNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startNode( + request: protos.google.cloud.tpu.v1.IStartNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request: protos.google.cloud.tpu.v1.IStartNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request?: protos.google.cloud.tpu.v1.IStartNodeRequest, + 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.startNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startNode()`. + * @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/tpu.start_node.js + * region_tag:tpu_v1_generated_Tpu_StartNode_async + */ + async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v1.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v1.IListNodesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.INode[], + protos.google.cloud.tpu.v1.IListNodesRequest|null, + protos.google.cloud.tpu.v1.IListNodesResponse + ]>; + listNodes( + request: protos.google.cloud.tpu.v1.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListNodesRequest, + protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v1.INode>): void; + listNodes( + request: protos.google.cloud.tpu.v1.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListNodesRequest, + protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v1.INode>): void; + listNodes( + request?: protos.google.cloud.tpu.v1.IListNodesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v1.IListNodesRequest, + protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v1.INode>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v1.IListNodesRequest, + protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v1.INode>): + Promise<[ + protos.google.cloud.tpu.v1.INode[], + protos.google.cloud.tpu.v1.IListNodesRequest|null, + protos.google.cloud.tpu.v1.IListNodesResponse + ]>|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.listNodes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v1.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNodes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v1.Node}. 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/tpu.list_nodes.js + * region_tag:tpu_v1_generated_Tpu_ListNodes_async + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List TensorFlow versions supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. + * 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 `listTensorFlowVersionsAsync()` + * 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. + */ + listTensorFlowVersions( + request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.ITensorFlowVersion[], + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest|null, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse + ]>; + listTensorFlowVersions( + request: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, + protos.google.cloud.tpu.v1.ITensorFlowVersion>): void; + listTensorFlowVersions( + request: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, + protos.google.cloud.tpu.v1.ITensorFlowVersion>): void; + listTensorFlowVersions( + request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, + protos.google.cloud.tpu.v1.ITensorFlowVersion>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, + protos.google.cloud.tpu.v1.ITensorFlowVersion>): + Promise<[ + protos.google.cloud.tpu.v1.ITensorFlowVersion[], + protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest|null, + protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse + ]>|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.listTensorFlowVersions(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion} 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 `listTensorFlowVersionsAsync()` + * 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. + */ + listTensorFlowVersionsStream( + request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + 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['listTensorFlowVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTensorFlowVersions.createStream( + this.innerApiCalls.listTensorFlowVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTensorFlowVersions`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. 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/tpu.list_tensor_flow_versions.js + * region_tag:tpu_v1_generated_Tpu_ListTensorFlowVersions_async + */ + listTensorFlowVersionsAsync( + request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, + 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['listTensorFlowVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTensorFlowVersions.asyncIterate( + this.innerApiCalls['listTensorFlowVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists accelerator types supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. + * 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v1.IAcceleratorType[], + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse + ]>; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v1.IAcceleratorType>): void; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v1.IAcceleratorType>): void; + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v1.IAcceleratorType>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v1.IAcceleratorType>): + Promise<[ + protos.google.cloud.tpu.v1.IAcceleratorType[], + protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse + ]>|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.listAcceleratorTypes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType} 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypesStream( + request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.createStream( + this.innerApiCalls.listAcceleratorTypes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAcceleratorTypes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. 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/tpu.list_accelerator_types.js + * region_tag:tpu_v1_generated_Tpu_ListAcceleratorTypes_async + */ + listAcceleratorTypesAsync( + request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.asyncIterate( + this.innerApiCalls['listAcceleratorTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * 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 [Location]{@link google.cloud.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 + * [Location]{@link google.cloud.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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} accelerator_type + * @returns {string} Resource name string. + */ + acceleratorTypePath(project:string,location:string,acceleratorType:string) { + return this.pathTemplates.acceleratorTypePathTemplate.render({ + project: project, + location: location, + accelerator_type: acceleratorType, + }); + } + + /** + * Parse the project from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; + } + + /** + * Parse the location from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; + } + + /** + * Parse the accelerator_type from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the accelerator_type. + */ + matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; + } + + /** + * 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 node resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node + * @returns {string} Resource name string. + */ + nodePath(project:string,location:string,node:string) { + return this.pathTemplates.nodePathTemplate.render({ + project: project, + location: location, + node: node, + }); + } + + /** + * Parse the project from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).project; + } + + /** + * Parse the location from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).location; + } + + /** + * Parse the node from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the node. + */ + matchNodeFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).node; + } + + /** + * 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 tensorFlowVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} tensor_flow_version + * @returns {string} Resource name string. + */ + tensorFlowVersionPath(project:string,location:string,tensorFlowVersion:string) { + return this.pathTemplates.tensorFlowVersionPathTemplate.render({ + project: project, + location: location, + tensor_flow_version: tensorFlowVersion, + }); + } + + /** + * Parse the project from TensorFlowVersion resource. + * + * @param {string} tensorFlowVersionName + * A fully-qualified path representing TensorFlowVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTensorFlowVersionName(tensorFlowVersionName: string) { + return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).project; + } + + /** + * Parse the location from TensorFlowVersion resource. + * + * @param {string} tensorFlowVersionName + * A fully-qualified path representing TensorFlowVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTensorFlowVersionName(tensorFlowVersionName: string) { + return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).location; + } + + /** + * Parse the tensor_flow_version from TensorFlowVersion resource. + * + * @param {string} tensorFlowVersionName + * A fully-qualified path representing TensorFlowVersion resource. + * @returns {string} A string representing the tensor_flow_version. + */ + matchTensorFlowVersionFromTensorFlowVersionName(tensorFlowVersionName: string) { + return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).tensor_flow_version; + } + + /** + * 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.tpuStub && !this._terminated) { + return this.tpuStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json new file mode 100644 index 00000000000..77bd991e873 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json @@ -0,0 +1,81 @@ +{ + "interfaces": { + "google.cloud.tpu.v1.Tpu": { + "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": { + "ListNodes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReimageNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTensorFlowVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetTensorFlowVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAcceleratorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAcceleratorType": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json new file mode 100644 index 00000000000..c79018be060 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/tpu/v1/cloud_tpu.proto" +] diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..9cb87c17e68 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const tpu = require('@google-cloud/tpu'); + +function main() { + const tpuClient = new tpu.TpuClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..50ac473b84f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {TpuClient} from '@google-cloud/tpu'; + +// check that the client class type name can be used +function doStuffWithTpuClient(client: TpuClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const tpuClient = new TpuClient(); + doStuffWithTpuClient(tpuClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts b/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts new file mode 100644 index 00000000000..b3743be7903 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts @@ -0,0 +1,2672 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as tpuModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, 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('v1.TpuClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v1.TpuClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v1.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tpuModule.v1.TpuClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tpuModule.v1.TpuClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v1.TpuClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); + }); + + it('has close method for the initialized client', done => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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('getNode', () => { + it('invokes getNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.Node() + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.Node() + ); + client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.INode|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with closed client', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNode(request), expectedError); + }); + }); + + describe('getTensorFlowVersion', () => { + it('invokes getTensorFlowVersion without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.TensorFlowVersion() + ); + client.innerApiCalls.getTensorFlowVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getTensorFlowVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTensorFlowVersion without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.TensorFlowVersion() + ); + client.innerApiCalls.getTensorFlowVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTensorFlowVersion( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.ITensorFlowVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTensorFlowVersion with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTensorFlowVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTensorFlowVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getTensorFlowVersion with closed client', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getTensorFlowVersion(request), expectedError); + }); + }); + + describe('getAcceleratorType', () => { + it('invokes getAcceleratorType without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); + const [response] = await client.getAcceleratorType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAcceleratorType( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.IAcceleratorType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAcceleratorType(request), expectedError); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with closed client', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAcceleratorType(request), expectedError); + }); + }); + + describe('createNode', () => { + it('invokes createNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNode( + 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.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with call error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createNode(request), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with LRO error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNodeProgress without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkCreateNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeProgress with error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkCreateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteNode', () => { + it('invokes deleteNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNode( + 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.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with call error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteNode(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with LRO error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteNodeProgress without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkDeleteNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNodeProgress with error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkDeleteNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('reimageNode', () => { + it('invokes reimageNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ReimageNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reimageNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.reimageNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reimageNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ReimageNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reimageNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reimageNode( + 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.reimageNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reimageNode with call error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ReimageNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reimageNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reimageNode(request), expectedError); + const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reimageNode with LRO error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ReimageNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reimageNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reimageNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReimageNodeProgress without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkReimageNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReimageNodeProgress with error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkReimageNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopNode', () => { + it('invokes stopNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopNode( + 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.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with call error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopNode(request), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with LRO error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopNodeProgress without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkStopNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopNodeProgress with error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkStopNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startNode', () => { + it('invokes startNode without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.startNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startNode( + 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.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with call error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startNode(request), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with LRO error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartNodeProgress without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkStartNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartNodeProgress with error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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.checkStartNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.INode[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + ]; + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v1.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v1.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listTensorFlowVersions', () => { + it('invokes listTensorFlowVersions without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + ]; + client.innerApiCalls.listTensorFlowVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listTensorFlowVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTensorFlowVersions without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + ]; + client.innerApiCalls.listTensorFlowVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTensorFlowVersions( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.ITensorFlowVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTensorFlowVersions with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTensorFlowVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTensorFlowVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listTensorFlowVersionsStream without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + ]; + client.descriptors.page.listTensorFlowVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTensorFlowVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.TensorFlowVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.TensorFlowVersion) => { + 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.listTensorFlowVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTensorFlowVersions, request)); + assert( + (client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listTensorFlowVersionsStream with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTensorFlowVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTensorFlowVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.TensorFlowVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.TensorFlowVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTensorFlowVersions, request)); + assert( + (client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTensorFlowVersions without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), + ]; + client.descriptors.page.listTensorFlowVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v1.ITensorFlowVersion[] = []; + const iterable = client.listTensorFlowVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listTensorFlowVersions with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTensorFlowVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTensorFlowVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v1.ITensorFlowVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v1.IAcceleratorType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v1.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v1.AcceleratorType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v1.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v1.IAcceleratorType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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 tpuModule.v1.TpuClient({ + 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('acceleratorType', () => { + const fakePath = "/rendered/path/acceleratorType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + accelerator_type: "acceleratorTypeValue", + }; + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.acceleratorTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.acceleratorTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('acceleratorTypePath', () => { + const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAcceleratorTypeName', () => { + const result = client.matchProjectFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAcceleratorTypeName', () => { + const result = client.matchLocationFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAcceleratorTypeFromAcceleratorTypeName', () => { + const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "acceleratorTypeValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new tpuModule.v1.TpuClient({ + 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('node', () => { + const fakePath = "/rendered/path/node"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + node: "nodeValue", + }; + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath("projectValue", "locationValue", "nodeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, "nodeValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new tpuModule.v1.TpuClient({ + 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('tensorFlowVersion', () => { + const fakePath = "/rendered/path/tensorFlowVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + tensor_flow_version: "tensorFlowVersionValue", + }; + const client = new tpuModule.v1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.tensorFlowVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.tensorFlowVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('tensorFlowVersionPath', () => { + const result = client.tensorFlowVersionPath("projectValue", "locationValue", "tensorFlowVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.tensorFlowVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTensorFlowVersionName', () => { + const result = client.matchProjectFromTensorFlowVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTensorFlowVersionName', () => { + const result = client.matchLocationFromTensorFlowVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTensorFlowVersionFromTensorFlowVersionName', () => { + const result = client.matchTensorFlowVersionFromTensorFlowVersionName(fakePath); + assert.strictEqual(result, "tensorFlowVersionValue"); + assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-tpu/v1/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v1/webpack.config.js new file mode 100644 index 00000000000..8ee514d072f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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: 'Tpu', + filename: './tpu.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-cloud-tpu/v2/.eslintignore b/owl-bot-staging/google-cloud-tpu/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/.gitignore b/owl-bot-staging/google-cloud-tpu/v2/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js new file mode 100644 index 00000000000..5b3c57ae725 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/tpu', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/README.md b/owl-bot-staging/google-cloud-tpu/v2/README.md new file mode 100644 index 00000000000..b04db0dc280 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/README.md @@ -0,0 +1 @@ +Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/package.json b/owl-bot-staging/google-cloud-tpu/v2/package.json new file mode 100644 index 00000000000..911441f5cee --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/tpu", + "version": "0.1.0", + "description": "Tpu client for Node.js", + "repository": "googleapis/nodejs-tpu", + "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 tpu", + "tpu", + "tpu" + ], + "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.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto b/owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto new file mode 100644 index 00000000000..b99a2013c2d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto @@ -0,0 +1,795 @@ +// 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.cloud.tpu.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v2;tpu"; +option java_multiple_files = true; +option java_outer_classname = "CloudTpuProto"; +option java_package = "com.google.cloud.tpu.v2"; + +// Manages TPU nodes and other resources +// +// TPU API v2 +service Tpu { + option (google.api.default_host) = "tpu.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists nodes. + rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/nodes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a node. + rpc GetNode(GetNodeRequest) returns (Node) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a node. + rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/nodes" + body: "node" + }; + option (google.api.method_signature) = "parent,node,node_id"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a node. + rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Stops a node. This operation is only available with single TPU nodes. + rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/nodes/*}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Starts a node. + rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/nodes/*}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Updates the configurations of a node. + rpc UpdateNode(UpdateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{node.name=projects/*/locations/*/nodes/*}" + body: "node" + }; + option (google.api.method_signature) = "node,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Generates the Cloud TPU service identity for the project. + rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}:generateServiceIdentity" + body: "*" + }; + } + + // Lists accelerator types supported by this API. + rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/acceleratorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets AcceleratorType. + rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/acceleratorTypes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists runtime versions supported by this API. + rpc ListRuntimeVersions(ListRuntimeVersionsRequest) returns (ListRuntimeVersionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/runtimeVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a runtime version. + rpc GetRuntimeVersion(GetRuntimeVersionRequest) returns (RuntimeVersion) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/runtimeVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the guest attributes for the node. + rpc GetGuestAttributes(GetGuestAttributesRequest) returns (GetGuestAttributesResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/nodes/*}:getGuestAttributes" + body: "*" + }; + } +} + +// A guest attributes. +message GuestAttributes { + // The path to be queried. This can be the default namespace ('/') or a + // nested namespace ('/\/') or a specified key + // ('/\/\') + string query_path = 1; + + // The value of the requested queried path. + GuestAttributesValue query_value = 2; +} + +// Array of guest attribute namespace/key/value tuples. +message GuestAttributesValue { + // The list of guest attributes entries. + repeated GuestAttributesEntry items = 1; +} + +// A guest attributes namespace/key/value entry. +message GuestAttributesEntry { + // Namespace for the guest attribute entry. + string namespace = 1; + + // Key for the guest attribute entry. + string key = 2; + + // Value for the guest attribute entry. + string value = 3; +} + +// A node-attached disk resource. +// Next ID: 8; +message AttachedDisk { + // The different mode of the attached disk. + enum DiskMode { + // The disk mode is not known/set. + DISK_MODE_UNSPECIFIED = 0; + + // Attaches the disk in read-write mode. Only one TPU node can attach a disk + // in read-write mode at a time. + READ_WRITE = 1; + + // Attaches the disk in read-only mode. Multiple TPU nodes can attach + // a disk in read-only mode at a time. + READ_ONLY = 2; + } + + // Specifies the full path to an existing disk. + // For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + string source_disk = 3; + + // The mode in which to attach this disk. + // If not specified, the default is READ_WRITE mode. + // Only applicable to data_disks. + DiskMode mode = 4; +} + +// Sets the scheduling options for this node. +message SchedulingConfig { + // Defines whether the node is preemptible. + bool preemptible = 1; + + // Whether the node is created under a reservation. + bool reserved = 2; +} + +// A network endpoint over which a TPU worker can be reached. +message NetworkEndpoint { + // The internal IP address of this network endpoint. + string ip_address = 1; + + // The port of this network endpoint. + int32 port = 2; + + // The access config for the TPU worker. + AccessConfig access_config = 5; +} + +// An access config attached to the TPU worker. +message AccessConfig { + // Output only. An external IP address associated with the TPU worker. + string external_ip = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network related configurations. +message NetworkConfig { + // The name of the network for the TPU node. It must be a preexisting Google + // Compute Engine network. If none is provided, "default" will be used. + string network = 1; + + // The name of the subnetwork for the TPU node. It must be a preexisting + // Google Compute Engine subnetwork. If none is provided, "default" will be + // used. + string subnetwork = 2; + + // Indicates that external IP addresses would be associated with the TPU + // workers. If set to false, the specified subnetwork or network should have + // Private Google Access enabled. + bool enable_external_ips = 3; + + // Allows the TPU node to send and receive packets with non-matching + // destination or source IPs. This is required if you plan to use the TPU + // workers to forward routes. + bool can_ip_forward = 4; +} + +// A service account. +message ServiceAccount { + // Email address of the service account. If empty, default Compute service + // account will be used. + string email = 1; + + // The list of scopes to be made available for this service account. If empty, + // access to all Cloud APIs will be allowed. + repeated string scope = 2; +} + +// A TPU instance. +message Node { + option (google.api.resource) = { + type: "tpu.googleapis.com/Node" + pattern: "projects/{project}/locations/{location}/nodes/{node}" + }; + + // Represents the different states of a TPU node during its lifecycle. + enum State { + // TPU node state is not known/set. + STATE_UNSPECIFIED = 0; + + // TPU node is being created. + CREATING = 1; + + // TPU node has been created. + READY = 2; + + // TPU node is restarting. + RESTARTING = 3; + + // TPU node is undergoing reimaging. + REIMAGING = 4; + + // TPU node is being deleted. + DELETING = 5; + + // TPU node is being repaired and may be unusable. Details can be + // found in the `help_description` field. + REPAIRING = 6; + + // TPU node is stopped. + STOPPED = 8; + + // TPU node is currently stopping. + STOPPING = 9; + + // TPU node is currently starting. + STARTING = 10; + + // TPU node has been preempted. Only applies to Preemptible TPU Nodes. + PREEMPTED = 11; + + // TPU node has been terminated due to maintenance or has reached the end of + // its life cycle (for preemptible nodes). + TERMINATED = 12; + + // TPU node is currently hiding. + HIDING = 13; + + // TPU node has been hidden. + HIDDEN = 14; + + // TPU node is currently unhiding. + UNHIDING = 15; + } + + // Health defines the status of a TPU node as reported by + // Health Monitor. + enum Health { + // Health status is unknown: not initialized or failed to retrieve. + HEALTH_UNSPECIFIED = 0; + + // The resource is healthy. + HEALTHY = 1; + + // The resource is unresponsive. + TIMEOUT = 3; + + // The in-guest ML stack is unhealthy. + UNHEALTHY_TENSORFLOW = 4; + + // The node is under maintenance/priority boost caused rescheduling and + // will resume running once rescheduled. + UNHEALTHY_MAINTENANCE = 5; + } + + // TPU API Version. + enum ApiVersion { + // API version is unknown. + API_VERSION_UNSPECIFIED = 0; + + // TPU API V1Alpha1 version. + V1_ALPHA1 = 1; + + // TPU API V1 version. + V1 = 2; + + // TPU API V2Alpha1 version. + V2_ALPHA1 = 3; + + // TPU API V2 version. + V2 = 4; + } + + // Output only. Immutable. The name of the TPU. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The user-supplied description of the TPU. Maximum of 512 characters. + string description = 3; + + // Required. The type of hardware accelerators associated with this node. + string accelerator_type = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The current state for the TPU Node. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If this field is populated, it contains a description of why the TPU Node + // is unhealthy. + string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The runtime version running in the Node. + string runtime_version = 11 [(google.api.field_behavior) = REQUIRED]; + + // Network configurations for the TPU node. + NetworkConfig network_config = 36; + + // The CIDR block that the TPU node will use when selecting an IP address. + // This CIDR block must be a /29 block; the Compute Engine networks API + // forbids a smaller block, and using a larger block would be wasteful (a + // node can only consume one IP address). Errors will occur if the CIDR block + // has already been used for a currently existing TPU node, the CIDR block + // conflicts with any subnetworks in the user's provided network, or the + // provided network is peered with another network that is using that CIDR + // block. + string cidr_block = 13; + + // The Google Cloud Platform Service Account to be used by the TPU node VMs. + // If None is specified, the default compute service account will be used. + ServiceAccount service_account = 37; + + // Output only. The time when the node was created. + google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The scheduling options for this node. + SchedulingConfig scheduling_config = 17; + + // Output only. The network endpoints where TPU workers can be accessed and + // sent work. It is recommended that runtime clients of the node reach out + // to the 0th entry in this map first. + repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The health status of the TPU node. + Health health = 22; + + // Resource labels to represent user-provided metadata. + map labels = 24; + + // Custom metadata to apply to the TPU Node. + // Can set startup-script and shutdown-script + map metadata = 34; + + // Tags to apply to the TPU Node. Tags are used to identify valid sources or + // targets for network firewalls. + repeated string tags = 40; + + // Output only. The unique identifier for the TPU Node. + int64 id = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The additional data disks for the Node. + repeated AttachedDisk data_disks = 41; + + // Output only. The API version that created this Node. + ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Symptoms that have occurred to the TPU Node. + repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 45; +} + +// Request for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes]. +message ListNodesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Node" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListNodes][google.cloud.tpu.v2.Tpu.ListNodes]. +message ListNodesResponse { + // The listed nodes. + repeated Node nodes = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetNode][google.cloud.tpu.v2.Tpu.GetNode]. +message GetNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [CreateNode][google.cloud.tpu.v2.Tpu.CreateNode]. +message CreateNodeRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [DeleteNode][google.cloud.tpu.v2.Tpu.DeleteNode]. +message DeleteNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [StopNode][google.cloud.tpu.v2.Tpu.StopNode]. +message StopNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [StartNode][google.cloud.tpu.v2.Tpu.StartNode]. +message StartNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [UpdateNode][google.cloud.tpu.v2.Tpu.UpdateNode]. +message UpdateNodeRequest { + // Required. Mask of fields from [Node][Tpu.Node] to update. + // Supported fields: [description, tags, labels, metadata, + // network_config.enable_external_ips]. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The node. Only fields specified in update_mask are updated. + Node node = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The per-product per-project service identity for Cloud TPU service. +message ServiceIdentity { + // The email address of the service identity. + string email = 1; +} + +// Request for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response for [GenerateServiceIdentity][google.cloud.tpu.v2.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityResponse { + // ServiceIdentity that was created or retrieved. + ServiceIdentity identity = 1; +} + +// A accelerator type that a Node can be configured with. +message AcceleratorType { + option (google.api.resource) = { + type: "tpu.googleapis.com/AcceleratorType" + pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }; + + // The resource name. + string name = 1; + + // the accelerator type. + string type = 2; +} + +// Request for [GetAcceleratorType][google.cloud.tpu.v2.Tpu.GetAcceleratorType]. +message GetAcceleratorTypeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; +} + +// Request for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/AcceleratorType" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListAcceleratorTypes][google.cloud.tpu.v2.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesResponse { + // The listed nodes. + repeated AcceleratorType accelerator_types = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A runtime version that a Node can be configured with. +message RuntimeVersion { + option (google.api.resource) = { + type: "tpu.googleapis.com/RuntimeVersion" + pattern: "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" + }; + + // The resource name. + string name = 1; + + // The runtime version. + string version = 2; +} + +// Request for [GetRuntimeVersion][google.cloud.tpu.v2.Tpu.GetRuntimeVersion]. +message GetRuntimeVersionRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/RuntimeVersion" + } + ]; +} + +// Request for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/RuntimeVersion" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListRuntimeVersions][google.cloud.tpu.v2.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsResponse { + // The listed nodes. + repeated RuntimeVersion runtime_versions = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} + +// A Symptom instance. +message Symptom { + // SymptomType represents the different types of Symptoms that a TPU can be + // at. + enum SymptomType { + // Unspecified symptom. + SYMPTOM_TYPE_UNSPECIFIED = 0; + + // TPU VM memory is low. + LOW_MEMORY = 1; + + // TPU runtime is out of memory. + OUT_OF_MEMORY = 2; + + // TPU runtime execution has timed out. + EXECUTE_TIMED_OUT = 3; + + // TPU runtime fails to construct a mesh that recognizes each TPU device's + // neighbors. + MESH_BUILD_FAIL = 4; + + // TPU HBM is out of memory. + HBM_OUT_OF_MEMORY = 5; + + // Abusive behaviors have been identified on the current project. + PROJECT_ABUSE = 6; + } + + // Timestamp when the Symptom is created. + google.protobuf.Timestamp create_time = 1; + + // Type of the Symptom. + SymptomType symptom_type = 2; + + // Detailed information of the current Symptom. + string details = 3; + + // A string used to uniquely distinguish a worker within a TPU node. + string worker_id = 4; +} + +// Request for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes]. +message GetGuestAttributesRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; + + // The guest attributes path to be queried. + string query_path = 2; + + // The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + // returned. + repeated string worker_ids = 3; +} + +// Response for [GetGuestAttributes][google.cloud.tpu.v2.Tpu.GetGuestAttributes]. +message GetGuestAttributesResponse { + // The guest attributes for the TPU workers. + repeated GuestAttributes guest_attributes = 1; +} + +// A set of Shielded Instance options. +message ShieldedInstanceConfig { + // Defines whether the instance has Secure Boot enabled. + bool enable_secure_boot = 1; +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json new file mode 100644 index 00000000000..177da816340 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json @@ -0,0 +1,595 @@ +{ + "clientLibrary": { + "name": "nodejs-tpu", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.tpu.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "tpu_v2_generated_Tpu_ListNodes_async", + "title": "Tpu listNodes Sample", + "origin": "API_DEFINITION", + "description": " Lists nodes.", + "canonical": true, + "file": "tpu.list_nodes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListNodesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetNode_async", + "title": "Tpu getNode Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a node.", + "canonical": true, + "file": "tpu.get_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2.Tpu.GetNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.Node", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2.Tpu.GetNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_CreateNode_async", + "title": "Tpu createNode Sample", + "origin": "API_DEFINITION", + "description": " Creates a node.", + "canonical": true, + "file": "tpu.create_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "node_id", + "type": "TYPE_STRING" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_DeleteNode_async", + "title": "Tpu deleteNode Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node.", + "canonical": true, + "file": "tpu.delete_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_StopNode_async", + "title": "Tpu stopNode Sample", + "origin": "API_DEFINITION", + "description": " Stops a node. This operation is only available with single TPU nodes.", + "canonical": true, + "file": "tpu.stop_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2.Tpu.StopNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2.Tpu.StopNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_StartNode_async", + "title": "Tpu startNode Sample", + "origin": "API_DEFINITION", + "description": " Starts a node.", + "canonical": true, + "file": "tpu.start_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2.Tpu.StartNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2.Tpu.StartNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_UpdateNode_async", + "title": "Tpu updateNode Sample", + "origin": "API_DEFINITION", + "description": " Updates the configurations of a node.", + "canonical": true, + "file": "tpu.update_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GenerateServiceIdentity_async", + "title": "Tpu generateServiceIdentity Sample", + "origin": "API_DEFINITION", + "description": " Generates the Cloud TPU service identity for the project.", + "canonical": true, + "file": "tpu.generate_service_identity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.GenerateServiceIdentityResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_ListAcceleratorTypes_async", + "title": "Tpu listAcceleratorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists accelerator types supported by this API.", + "canonical": true, + "file": "tpu.list_accelerator_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListAcceleratorTypesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetAcceleratorType_async", + "title": "Tpu getAcceleratorType Sample", + "origin": "API_DEFINITION", + "description": " Gets AcceleratorType.", + "canonical": true, + "file": "tpu.get_accelerator_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.AcceleratorType", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_ListRuntimeVersions_async", + "title": "Tpu listRuntimeVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists runtime versions supported by this API.", + "canonical": true, + "file": "tpu.list_runtime_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListRuntimeVersionsResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetRuntimeVersion_async", + "title": "Tpu getRuntimeVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a runtime version.", + "canonical": true, + "file": "tpu.get_runtime_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.RuntimeVersion", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetGuestAttributes_async", + "title": "Tpu getGuestAttributes Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the guest attributes for the node.", + "canonical": true, + "file": "tpu.get_guest_attributes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "query_path", + "type": "TYPE_STRING" + }, + { + "name": "worker_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.tpu.v2.GetGuestAttributesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js new file mode 100644 index 00000000000..83f1cccd941 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, node) { + // [START tpu_v2_generated_Tpu_CreateNode_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 name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. + */ + // const nodeId = 'abc123' + /** + * Required. The node. + */ + // const node = {} + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callCreateNode() { + // Construct request + const request = { + parent, + node, + }; + + // Run request + const [operation] = await tpuClient.createNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateNode(); + // [END tpu_v2_generated_Tpu_CreateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js new file mode 100644 index 00000000000..8634975b574 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_DeleteNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callDeleteNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteNode(); + // [END tpu_v2_generated_Tpu_DeleteNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js new file mode 100644 index 00000000000..9575296eb04 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2_generated_Tpu_GenerateServiceIdentity_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 name. + */ + // const parent = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGenerateServiceIdentity() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await tpuClient.generateServiceIdentity(request); + console.log(response); + } + + callGenerateServiceIdentity(); + // [END tpu_v2_generated_Tpu_GenerateServiceIdentity_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js new file mode 100644 index 00000000000..4f7c972f4f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_GetAcceleratorType_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetAcceleratorType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getAcceleratorType(request); + console.log(response); + } + + callGetAcceleratorType(); + // [END tpu_v2_generated_Tpu_GetAcceleratorType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js new file mode 100644 index 00000000000..ef6522b40eb --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_GetGuestAttributes_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. + */ + // const name = 'abc123' + /** + * The guest attributes path to be queried. + */ + // const queryPath = 'abc123' + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + */ + // const workerIds = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetGuestAttributes() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getGuestAttributes(request); + console.log(response); + } + + callGetGuestAttributes(); + // [END tpu_v2_generated_Tpu_GetGuestAttributes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js new file mode 100644 index 00000000000..c2299bb1a39 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_GetNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetNode() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getNode(request); + console.log(response); + } + + callGetNode(); + // [END tpu_v2_generated_Tpu_GetNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js new file mode 100644 index 00000000000..d5e8a737d25 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_GetRuntimeVersion_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetRuntimeVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getRuntimeVersion(request); + console.log(response); + } + + callGetRuntimeVersion(); + // [END tpu_v2_generated_Tpu_GetRuntimeVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js new file mode 100644 index 00000000000..170976b1552 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2_generated_Tpu_ListAcceleratorTypes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListAcceleratorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listAcceleratorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAcceleratorTypes(); + // [END tpu_v2_generated_Tpu_ListAcceleratorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js new file mode 100644 index 00000000000..0927d7ec12d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2_generated_Tpu_ListNodes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListNodes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listNodesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNodes(); + // [END tpu_v2_generated_Tpu_ListNodes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js new file mode 100644 index 00000000000..a6262d1cab2 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2_generated_Tpu_ListRuntimeVersions_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListRuntimeVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listRuntimeVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRuntimeVersions(); + // [END tpu_v2_generated_Tpu_ListRuntimeVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js new file mode 100644 index 00000000000..1babfa601ce --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_StartNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStartNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.startNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartNode(); + // [END tpu_v2_generated_Tpu_StartNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js new file mode 100644 index 00000000000..b95730d2d17 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2_generated_Tpu_StopNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStopNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.stopNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopNode(); + // [END tpu_v2_generated_Tpu_StopNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js new file mode 100644 index 00000000000..cdfd0d9efab --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, node) { + // [START tpu_v2_generated_Tpu_UpdateNode_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. Mask of fields from Node Tpu.Node to update. + * Supported fields: description, tags, labels, metadata, + * network_config.enable_external_ips. + */ + // const updateMask = {} + /** + * Required. The node. Only fields specified in update_mask are updated. + */ + // const node = {} + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callUpdateNode() { + // Construct request + const request = { + updateMask, + node, + }; + + // Run request + const [operation] = await tpuClient.updateNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateNode(); + // [END tpu_v2_generated_Tpu_UpdateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2/src/index.ts new file mode 100644 index 00000000000..b5f3bb8b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +const TpuClient = v2.TpuClient; +type TpuClient = v2.TpuClient; +export {v2, TpuClient}; +export default {v2, TpuClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-tpu/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..0429be2165c --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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.cloud.tpu.v2", + "libraryPackage": "@google-cloud/tpu", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts new file mode 100644 index 00000000000..27c81814923 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {TpuClient} from './tpu_client'; diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts new file mode 100644 index 00000000000..59a9575625f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts @@ -0,0 +1,2249 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/tpu_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tpu_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages TPU nodes and other resources + * + * TPU API v2 + * @class + * @memberof v2 + */ +export class TpuClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tpuStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TpuClient. + * + * @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 TpuClient({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 TpuClient; + 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.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 = { + acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodes/{node}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' + ), + }; + + // 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 = { + listNodes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), + listAcceleratorTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes'), + listRuntimeVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'runtimeVersions') + }; + + 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.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*}',},{get: '/v2/{name=projects/*/locations/*}',}], + },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=projects/*}/locations',},{get: '/v2alpha1/{name=projects/*}/locations',},{get: '/v2/{name=projects/*}/locations',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}/operations',},{get: '/v2alpha1/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; + const createNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; + const deleteNodeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; + const stopNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; + const stopNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; + const startNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; + const startNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; + const updateNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; + const updateNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeResponse.decode.bind(createNodeResponse), + createNodeMetadata.decode.bind(createNodeMetadata)), + deleteNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNodeResponse.decode.bind(deleteNodeResponse), + deleteNodeMetadata.decode.bind(deleteNodeMetadata)), + stopNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopNodeResponse.decode.bind(stopNodeResponse), + stopNodeMetadata.decode.bind(stopNodeMetadata)), + startNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startNodeResponse.decode.bind(startNodeResponse), + startNodeMetadata.decode.bind(startNodeMetadata)), + updateNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateNodeResponse.decode.bind(updateNodeResponse), + updateNodeMetadata.decode.bind(updateNodeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.tpu.v2.Tpu', 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.tpuStub) { + return this.tpuStub; + } + + // Put together the "service stub" for + // google.cloud.tpu.v2.Tpu. + this.tpuStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v2.Tpu') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.tpu.v2.Tpu, + 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 tpuStubMethods = + ['listNodes', 'getNode', 'createNode', 'deleteNode', 'stopNode', 'startNode', 'updateNode', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes']; + for (const methodName of tpuStubMethods) { + const callPromise = this.tpuStub.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.tpuStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'tpu.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 'tpu.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 the details of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [Node]{@link google.cloud.tpu.v2.Node}. + * 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/tpu.get_node.js + * region_tag:tpu_v2_generated_Tpu_GetNode_async + */ + getNode( + request?: protos.google.cloud.tpu.v2.IGetNodeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|undefined, {}|undefined + ]>; + getNode( + request: protos.google.cloud.tpu.v2.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request: protos.google.cloud.tpu.v2.IGetNodeRequest, + callback: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request?: protos.google.cloud.tpu.v2.IGetNodeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest|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.getNode(request, options, callback); + } +/** + * Generates the Cloud TPU service identity for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @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 [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2.GenerateServiceIdentityResponse}. + * 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/tpu.generate_service_identity.js + * region_tag:tpu_v2_generated_Tpu_GenerateServiceIdentity_async + */ + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|undefined, {}|undefined + ]>; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): void; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): void; + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|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.generateServiceIdentity(request, options, callback); + } +/** + * Gets AcceleratorType. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. + * 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/tpu.get_accelerator_type.js + * region_tag:tpu_v2_generated_Tpu_GetAcceleratorType_async + */ + getAcceleratorType( + request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|undefined, {}|undefined + ]>; + getAcceleratorType( + request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); + } +/** + * Gets a runtime version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. + * 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/tpu.get_runtime_version.js + * region_tag:tpu_v2_generated_Tpu_GetRuntimeVersion_async + */ + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|undefined, {}|undefined + ]>; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): void; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): void; + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|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.getRuntimeVersion(request, options, callback); + } +/** + * Retrieves the guest attributes for the node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.queryPath + * The guest attributes path to be queried. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, all workers' GuestAttributes 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 [GetGuestAttributesResponse]{@link google.cloud.tpu.v2.GetGuestAttributesResponse}. + * 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/tpu.get_guest_attributes.js + * region_tag:tpu_v2_generated_Tpu_GetGuestAttributes_async + */ + getGuestAttributes( + request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|undefined, {}|undefined + ]>; + getGuestAttributes( + request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): void; + getGuestAttributes( + request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): void; + getGuestAttributes( + request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|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.getGuestAttributes(request, options, callback); + } + +/** + * Creates a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.nodeId + * The unqualified resource name. + * @param {google.cloud.tpu.v2.Node} request.node + * Required. The node. + * @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/tpu.create_node.js + * region_tag:tpu_v2_generated_Tpu_CreateNode_async + */ + createNode( + request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createNode( + request: protos.google.cloud.tpu.v2.ICreateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request: protos.google.cloud.tpu.v2.ICreateNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, + 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.createNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createNode()`. + * @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/tpu.create_node.js + * region_tag:tpu_v2_generated_Tpu_CreateNode_async + */ + async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.delete_node.js + * region_tag:tpu_v2_generated_Tpu_DeleteNode_async + */ + deleteNode( + request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteNode( + request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + 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.deleteNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteNode()`. + * @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/tpu.delete_node.js + * region_tag:tpu_v2_generated_Tpu_DeleteNode_async + */ + async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops a node. This operation is only available with single TPU nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.stop_node.js + * region_tag:tpu_v2_generated_Tpu_StopNode_async + */ + stopNode( + request?: protos.google.cloud.tpu.v2.IStopNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopNode( + request: protos.google.cloud.tpu.v2.IStopNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request: protos.google.cloud.tpu.v2.IStopNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request?: protos.google.cloud.tpu.v2.IStopNodeRequest, + 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.stopNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopNode()`. + * @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/tpu.stop_node.js + * region_tag:tpu_v2_generated_Tpu_StopNode_async + */ + async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.start_node.js + * region_tag:tpu_v2_generated_Tpu_StartNode_async + */ + startNode( + request?: protos.google.cloud.tpu.v2.IStartNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startNode( + request: protos.google.cloud.tpu.v2.IStartNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request: protos.google.cloud.tpu.v2.IStartNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request?: protos.google.cloud.tpu.v2.IStartNodeRequest, + 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.startNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startNode()`. + * @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/tpu.start_node.js + * region_tag:tpu_v2_generated_Tpu_StartNode_async + */ + async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the configurations of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields from {@link Tpu.Node|Node} to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * @param {google.cloud.tpu.v2.Node} request.node + * Required. The node. Only fields specified in update_mask are updated. + * @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/tpu.update_node.js + * region_tag:tpu_v2_generated_Tpu_UpdateNode_async + */ + updateNode( + request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateNode( + request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNode( + request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNode( + request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + 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({ + 'node.name': request.node!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateNode()`. + * @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/tpu.update_node.js + * region_tag:tpu_v2_generated_Tpu_UpdateNode_async + */ + async checkUpdateNodeProgress(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.updateNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.INode[], + protos.google.cloud.tpu.v2.IListNodesRequest|null, + protos.google.cloud.tpu.v2.IListNodesResponse + ]>; + listNodes( + request: protos.google.cloud.tpu.v2.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2.INode>): void; + listNodes( + request: protos.google.cloud.tpu.v2.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2.INode>): void; + listNodes( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2.INode>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2.INode>): + Promise<[ + protos.google.cloud.tpu.v2.INode[], + protos.google.cloud.tpu.v2.IListNodesRequest|null, + protos.google.cloud.tpu.v2.IListNodesResponse + ]>|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.listNodes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNodes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v2.Node}. 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/tpu.list_nodes.js + * region_tag:tpu_v2_generated_Tpu_ListNodes_async + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists accelerator types supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. + * 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IAcceleratorType[], + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + ]>; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2.IAcceleratorType>): void; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2.IAcceleratorType>): void; + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2.IAcceleratorType>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2.IAcceleratorType>): + Promise<[ + protos.google.cloud.tpu.v2.IAcceleratorType[], + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + ]>|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.listAcceleratorTypes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType} 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypesStream( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.createStream( + this.innerApiCalls.listAcceleratorTypes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAcceleratorTypes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. 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/tpu.list_accelerator_types.js + * region_tag:tpu_v2_generated_Tpu_ListAcceleratorTypes_async + */ + listAcceleratorTypesAsync( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.asyncIterate( + this.innerApiCalls['listAcceleratorTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists runtime versions supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. + * 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2.IRuntimeVersion[], + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest|null, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + ]>; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion>): void; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion>): void; + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion>): + Promise<[ + protos.google.cloud.tpu.v2.IRuntimeVersion[], + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest|null, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + ]>|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.listRuntimeVersions(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion} 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersionsStream( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.createStream( + this.innerApiCalls.listRuntimeVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRuntimeVersions`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. 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/tpu.list_runtime_versions.js + * region_tag:tpu_v2_generated_Tpu_ListRuntimeVersions_async + */ + listRuntimeVersionsAsync( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.asyncIterate( + this.innerApiCalls['listRuntimeVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * 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 [Location]{@link google.cloud.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 + * [Location]{@link google.cloud.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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} accelerator_type + * @returns {string} Resource name string. + */ + acceleratorTypePath(project:string,location:string,acceleratorType:string) { + return this.pathTemplates.acceleratorTypePathTemplate.render({ + project: project, + location: location, + accelerator_type: acceleratorType, + }); + } + + /** + * Parse the project from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; + } + + /** + * Parse the location from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; + } + + /** + * Parse the accelerator_type from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the accelerator_type. + */ + matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; + } + + /** + * 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 node resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node + * @returns {string} Resource name string. + */ + nodePath(project:string,location:string,node:string) { + return this.pathTemplates.nodePathTemplate.render({ + project: project, + location: location, + node: node, + }); + } + + /** + * Parse the project from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).project; + } + + /** + * Parse the location from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).location; + } + + /** + * Parse the node from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the node. + */ + matchNodeFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).node; + } + + /** + * 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 runtimeVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} runtime_version + * @returns {string} Resource name string. + */ + runtimeVersionPath(project:string,location:string,runtimeVersion:string) { + return this.pathTemplates.runtimeVersionPathTemplate.render({ + project: project, + location: location, + runtime_version: runtimeVersion, + }); + } + + /** + * Parse the project from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).project; + } + + /** + * Parse the location from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).location; + } + + /** + * Parse the runtime_version from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the runtime_version. + */ + matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).runtime_version; + } + + /** + * 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.tpuStub && !this._terminated) { + return this.tpuStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json new file mode 100644 index 00000000000..a2274bda3a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.tpu.v2.Tpu": { + "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": { + "ListNodes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateServiceIdentity": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAcceleratorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAcceleratorType": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimeVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRuntimeVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGuestAttributes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json new file mode 100644 index 00000000000..3a793a61077 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/tpu/v2/cloud_tpu.proto" +] diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..9cb87c17e68 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const tpu = require('@google-cloud/tpu'); + +function main() { + const tpuClient = new tpu.TpuClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..50ac473b84f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {TpuClient} from '@google-cloud/tpu'; + +// check that the client class type name can be used +function doStuffWithTpuClient(client: TpuClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const tpuClient = new TpuClient(); + doStuffWithTpuClient(tpuClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts b/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts new file mode 100644 index 00000000000..53c08b73811 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts @@ -0,0 +1,2892 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as tpuModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, 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.TpuClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v2.TpuClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v2.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tpuModule.v2.TpuClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tpuModule.v2.TpuClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v2.TpuClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); + }); + + it('has close method for the initialized client', done => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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('getNode', () => { + it('invokes getNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.Node() + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.Node() + ); + client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.INode|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNode(request), expectedError); + }); + }); + + describe('generateServiceIdentity', () => { + it('invokes generateServiceIdentity without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall(expectedResponse); + const [response] = await client.generateServiceIdentity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateServiceIdentity( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateServiceIdentity(request), expectedError); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateServiceIdentity(request), expectedError); + }); + }); + + describe('getAcceleratorType', () => { + it('invokes getAcceleratorType without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); + const [response] = await client.getAcceleratorType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAcceleratorType( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IAcceleratorType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAcceleratorType(request), expectedError); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAcceleratorType(request), expectedError); + }); + }); + + describe('getRuntimeVersion', () => { + it('invokes getRuntimeVersion without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getRuntimeVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRuntimeVersion( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IRuntimeVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + }); + }); + + describe('getGuestAttributes', () => { + it('invokes getGuestAttributes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = stubSimpleCall(expectedResponse); + const [response] = await client.getGuestAttributes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGuestAttributes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IGetGuestAttributesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGuestAttributes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGuestAttributes(request), expectedError); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGuestAttributes(request), expectedError); + }); + }); + + describe('createNode', () => { + it('invokes createNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNode( + 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.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createNode(request), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkCreateNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkCreateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteNode', () => { + it('invokes deleteNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNode( + 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.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteNode(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkDeleteNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkDeleteNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopNode', () => { + it('invokes stopNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopNode( + 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.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopNode(request), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStopNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStopNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startNode', () => { + it('invokes startNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.startNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startNode( + 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.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startNode(request), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStartNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStartNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateNode', () => { + it('invokes updateNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNode( + 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.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateNode(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkUpdateNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkUpdateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.INode[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IAcceleratorType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.AcceleratorType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimeVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimeVersions( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2.IRuntimeVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRuntimeVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersionsStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { + 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.listRuntimeVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRuntimeVersionsStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRuntimeVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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('acceleratorType', () => { + const fakePath = "/rendered/path/acceleratorType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + accelerator_type: "acceleratorTypeValue", + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.acceleratorTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.acceleratorTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('acceleratorTypePath', () => { + const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAcceleratorTypeName', () => { + const result = client.matchProjectFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAcceleratorTypeName', () => { + const result = client.matchLocationFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAcceleratorTypeFromAcceleratorTypeName', () => { + const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "acceleratorTypeValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new tpuModule.v2.TpuClient({ + 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('node', () => { + const fakePath = "/rendered/path/node"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + node: "nodeValue", + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath("projectValue", "locationValue", "nodeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, "nodeValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new tpuModule.v2.TpuClient({ + 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('runtimeVersion', () => { + const fakePath = "/rendered/path/runtimeVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + runtime_version: "runtimeVersionValue", + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.runtimeVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.runtimeVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('runtimeVersionPath', () => { + const result = client.runtimeVersionPath("projectValue", "locationValue", "runtimeVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRuntimeVersionName', () => { + const result = client.matchProjectFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRuntimeVersionName', () => { + const result = client.matchLocationFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRuntimeVersionFromRuntimeVersionName', () => { + const result = client.matchRuntimeVersionFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "runtimeVersionValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-tpu/v2/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v2/webpack.config.js new file mode 100644 index 00000000000..8ee514d072f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/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: 'Tpu', + filename: './tpu.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-cloud-tpu/v2alpha1/.eslintignore b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore b/owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.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-cloud-tpu/v2alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js new file mode 100644 index 00000000000..5b3c57ae725 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/tpu', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md b/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md new file mode 100644 index 00000000000..b04db0dc280 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md @@ -0,0 +1 @@ +Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/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-cloud-tpu/v2alpha1/package.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/package.json new file mode 100644 index 00000000000..911441f5cee --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/tpu", + "version": "0.1.0", + "description": "Tpu client for Node.js", + "repository": "googleapis/nodejs-tpu", + "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 tpu", + "tpu", + "tpu" + ], + "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.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto new file mode 100644 index 00000000000..b6f0623b787 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto @@ -0,0 +1,1169 @@ +// 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.cloud.tpu.v2alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/interval.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu"; +option java_multiple_files = true; +option java_outer_classname = "CloudTpuProto"; +option java_package = "com.google.cloud.tpu.v2alpha1"; + +// Manages TPU nodes and other resources +// +// TPU API v2alpha1 +service Tpu { + option (google.api.default_host) = "tpu.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists nodes. + rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/nodes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a node. + rpc GetNode(GetNodeRequest) returns (Node) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a node. + rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}/nodes" + body: "node" + }; + option (google.api.method_signature) = "parent,node,node_id"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a node. + rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Stops a node. This operation is only available with single TPU nodes. + rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Starts a node. + rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Updates the configurations of a node. + rpc UpdateNode(UpdateNodeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}" + body: "node" + }; + option (google.api.method_signature) = "node,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } + + // Lists queued resources. + rpc ListQueuedResources(ListQueuedResourcesRequest) returns (ListQueuedResourcesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a queued resource. + rpc GetQueuedResource(GetQueuedResourceRequest) returns (QueuedResource) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a QueuedResource TPU instance. + rpc CreateQueuedResource(CreateQueuedResourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" + body: "queued_resource" + }; + option (google.api.method_signature) = "parent,queued_resource,queued_resource_id"; + option (google.longrunning.operation_info) = { + response_type: "QueuedResource" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a QueuedResource TPU instance. + rpc DeleteQueuedResource(DeleteQueuedResourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "QueuedResource" + metadata_type: "OperationMetadata" + }; + } + + // Generates the Cloud TPU service identity for the project. + rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity" + body: "*" + }; + } + + // Lists accelerator types supported by this API. + rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets AcceleratorType. + rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists runtime versions supported by this API. + rpc ListRuntimeVersions(ListRuntimeVersionsRequest) returns (ListRuntimeVersionsResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a runtime version. + rpc GetRuntimeVersion(GetRuntimeVersionRequest) returns (RuntimeVersion) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the guest attributes for the node. + rpc GetGuestAttributes(GetGuestAttributesRequest) returns (GetGuestAttributesResponse) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes" + body: "*" + }; + } + + // Simulates a maintenance event. + rpc SimulateMaintenanceEvent(SimulateMaintenanceEventRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } +} + +// A guest attributes. +message GuestAttributes { + // The path to be queried. This can be the default namespace ('/') or a + // nested namespace ('/\/') or a specified key + // ('/\/\') + string query_path = 1; + + // The value of the requested queried path. + GuestAttributesValue query_value = 2; +} + +// Array of guest attribute namespace/key/value tuples. +message GuestAttributesValue { + // The list of guest attributes entries. + repeated GuestAttributesEntry items = 1; +} + +// A guest attributes namespace/key/value entry. +message GuestAttributesEntry { + // Namespace for the guest attribute entry. + string namespace = 1; + + // Key for the guest attribute entry. + string key = 2; + + // Value for the guest attribute entry. + string value = 3; +} + +// A node-attached disk resource. +// Next ID: 8; +message AttachedDisk { + // The different mode of the attached disk. + enum DiskMode { + // The disk mode is not known/set. + DISK_MODE_UNSPECIFIED = 0; + + // Attaches the disk in read-write mode. Only one TPU node can attach a disk + // in read-write mode at a time. + READ_WRITE = 1; + + // Attaches the disk in read-only mode. Multiple TPU nodes can attach + // a disk in read-only mode at a time. + READ_ONLY = 2; + } + + // Specifies the full path to an existing disk. + // For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + string source_disk = 3; + + // The mode in which to attach this disk. + // If not specified, the default is READ_WRITE mode. + // Only applicable to data_disks. + DiskMode mode = 4; +} + +// Sets the scheduling options for this node. +message SchedulingConfig { + // Defines whether the node is preemptible. + bool preemptible = 1; + + // Whether the node is created under a reservation. + bool reserved = 2; +} + +// A network endpoint over which a TPU worker can be reached. +message NetworkEndpoint { + // The internal IP address of this network endpoint. + string ip_address = 1; + + // The port of this network endpoint. + int32 port = 2; + + // The access config for the TPU worker. + AccessConfig access_config = 5; +} + +// An access config attached to the TPU worker. +message AccessConfig { + // Output only. An external IP address associated with the TPU worker. + string external_ip = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network related configurations. +message NetworkConfig { + // The name of the network for the TPU node. It must be a preexisting Google + // Compute Engine network. If none is provided, "default" will be used. + string network = 1; + + // The name of the subnetwork for the TPU node. It must be a preexisting + // Google Compute Engine subnetwork. If none is provided, "default" will be + // used. + string subnetwork = 2; + + // Indicates that external IP addresses would be associated with the TPU + // workers. If set to false, the specified subnetwork or network should have + // Private Google Access enabled. + bool enable_external_ips = 3; + + // Allows the TPU node to send and receive packets with non-matching + // destination or source IPs. This is required if you plan to use the TPU + // workers to forward routes. + bool can_ip_forward = 4; +} + +// A service account. +message ServiceAccount { + // Email address of the service account. If empty, default Compute service + // account will be used. + string email = 1; + + // The list of scopes to be made available for this service account. If empty, + // access to all Cloud APIs will be allowed. + repeated string scope = 2; +} + +// A TPU instance. +message Node { + option (google.api.resource) = { + type: "tpu.googleapis.com/Node" + pattern: "projects/{project}/locations/{location}/nodes/{node}" + }; + + // Represents the different states of a TPU node during its lifecycle. + enum State { + // TPU node state is not known/set. + STATE_UNSPECIFIED = 0; + + // TPU node is being created. + CREATING = 1; + + // TPU node has been created. + READY = 2; + + // TPU node is restarting. + RESTARTING = 3; + + // TPU node is undergoing reimaging. + REIMAGING = 4; + + // TPU node is being deleted. + DELETING = 5; + + // TPU node is being repaired and may be unusable. Details can be + // found in the 'help_description' field. + REPAIRING = 6; + + // TPU node is stopped. + STOPPED = 8; + + // TPU node is currently stopping. + STOPPING = 9; + + // TPU node is currently starting. + STARTING = 10; + + // TPU node has been preempted. Only applies to Preemptible TPU Nodes. + PREEMPTED = 11; + + // TPU node has been terminated due to maintenance or has reached the end of + // its life cycle (for preemptible nodes). + TERMINATED = 12; + + // TPU node is currently hiding. + HIDING = 13; + + // TPU node has been hidden. + HIDDEN = 14; + + // TPU node is currently unhiding. + UNHIDING = 15; + } + + // Health defines the status of a TPU node as reported by + // Health Monitor. + enum Health { + // Health status is unknown: not initialized or failed to retrieve. + HEALTH_UNSPECIFIED = 0; + + // The resource is healthy. + HEALTHY = 1; + + // The resource is unresponsive. + TIMEOUT = 3; + + // The in-guest ML stack is unhealthy. + UNHEALTHY_TENSORFLOW = 4; + + // The node is under maintenance/priority boost caused rescheduling and + // will resume running once rescheduled. + UNHEALTHY_MAINTENANCE = 5; + } + + // TPU API Version. + enum ApiVersion { + // API version is unknown. + API_VERSION_UNSPECIFIED = 0; + + // TPU API V1Alpha1 version. + V1_ALPHA1 = 1; + + // TPU API V1 version. + V1 = 2; + + // TPU API V2Alpha1 version. + V2_ALPHA1 = 3; + } + + // Output only. Immutable. The name of the TPU. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The user-supplied description of the TPU. Maximum of 512 characters. + string description = 3; + + // The type of hardware accelerators associated with this node. + string accelerator_type = 5; + + // Output only. The current state for the TPU Node. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. If this field is populated, it contains a description of why the TPU Node + // is unhealthy. + string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The runtime version running in the Node. + string runtime_version = 11 [(google.api.field_behavior) = REQUIRED]; + + // Network configurations for the TPU node. + NetworkConfig network_config = 36; + + // The CIDR block that the TPU node will use when selecting an IP address. + // This CIDR block must be a /29 block; the Compute Engine networks API + // forbids a smaller block, and using a larger block would be wasteful (a + // node can only consume one IP address). Errors will occur if the CIDR block + // has already been used for a currently existing TPU node, the CIDR block + // conflicts with any subnetworks in the user's provided network, or the + // provided network is peered with another network that is using that CIDR + // block. + string cidr_block = 13; + + // The Google Cloud Platform Service Account to be used by the TPU node VMs. + // If None is specified, the default compute service account will be used. + ServiceAccount service_account = 37; + + // Output only. The time when the node was created. + google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The scheduling options for this node. + SchedulingConfig scheduling_config = 17; + + // Output only. The network endpoints where TPU workers can be accessed and + // sent work. It is recommended that runtime clients of the node reach out + // to the 0th entry in this map first. + repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The health status of the TPU node. + Health health = 22; + + // Resource labels to represent user-provided metadata. + map labels = 24; + + // Custom metadata to apply to the TPU Node. + // Can set startup-script and shutdown-script + map metadata = 34; + + // Tags to apply to the TPU Node. Tags are used to identify valid sources or + // targets for network firewalls. + repeated string tags = 40; + + // Output only. The unique identifier for the TPU Node. + int64 id = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The additional data disks for the Node. + repeated AttachedDisk data_disks = 41; + + // Output only. The API version that created this Node. + ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Symptoms that have occurred to the TPU Node. + repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The qualified name of the QueuedResource that requested this Node. + string queued_resource = 43 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Shielded Instance options. + ShieldedInstanceConfig shielded_instance_config = 45; +} + +// A QueuedResource represents a request for resources that will be placed +// in a queue and fulfilled when the necessary resources are available. +message QueuedResource { + option (google.api.resource) = { + type: "tpu.googleapis.com/QueuedResource" + pattern: "projects/{project}/locations/{location}/queuedResources/{queued_resource}" + }; + + // Details of the TPU resource(s) being requested. + message Tpu { + // Details of the TPU node(s) being requested. Users can request either a + // single node or multiple nodes. + // NodeSpec provides the specification for node(s) to be created. + message NodeSpec { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + // regex format. This is only specified when requesting a single node. + // In case of multi-node requests, multi_node_params must be populated + // instead. It's an error to specify both node_id and multi_node_params. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // The TPU node(s) being requested. + repeated NodeSpec node_spec = 1; + } + + // BestEffort tier definition. + message BestEffort { + + } + + // Guaranteed tier definition. + message Guaranteed { + // Optional. Defines the minimum duration of the guarantee. If specified, + // the requested resources will only be provisioned if they can be + // allocated for at least the given duration. + google.protobuf.Duration min_duration = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the request should be scheduled on reserved capacity. + bool reserved = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Defines the policy of the QueuedRequest. + message QueueingPolicy { + // Time flexibility specification. + oneof start_timing_constraints { + // A relative time after which resources should not be created. + // If the request cannot be fulfilled by this time the request will be + // failed. + google.protobuf.Duration valid_until_duration = 1; + + // An absolute time after which resources should not be created. + // If the request cannot be fulfilled by this time the request will be + // failed. + google.protobuf.Timestamp valid_until_time = 2; + + // A relative time after which resources may be created. + google.protobuf.Duration valid_after_duration = 3; + + // An absolute time at which resources may be created. + google.protobuf.Timestamp valid_after_time = 4; + + // An absolute time interval within which resources may be created. + google.type.Interval valid_interval = 5; + } + } + + // Output only. Immutable. The name of the QueuedResource. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Resource specification. + oneof resource { + // Defines a TPU resource. + Tpu tpu = 2; + } + + // Tier specifies the required tier. + oneof tier { + // The BestEffort tier. + BestEffort best_effort = 3; + + // The Guaranteed tier + Guaranteed guaranteed = 4; + } + + // The queueing policy of the QueuedRequest. + QueueingPolicy queueing_policy = 5; + + // Output only. State of the QueuedResource request + QueuedResourceState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// QueuedResourceState defines the details of the QueuedResource request. +message QueuedResourceState { + // Output only state of the request + enum State { + // State of the QueuedResource request is not known/set. + STATE_UNSPECIFIED = 0; + + // The QueuedResource request has been received. We're still working on + // determining if we will be able to honor this request. + CREATING = 1; + + // The QueuedResource request has passed initial validation/admission + // control and has been persisted in the queue. + ACCEPTED = 2; + + // The QueuedResource request has been selected. The + // associated resources are currently being provisioned (or very soon + // will begin provisioning). + PROVISIONING = 3; + + // The request could not be completed. This may be due to some + // late-discovered problem with the request itself, or due to + // unavailability of resources within the constraints of the request + // (e.g., the 'valid until' start timing constraint expired). + FAILED = 4; + + // The QueuedResource is being deleted. + DELETING = 5; + + // The resources specified in the QueuedResource request have been + // provisioned and are ready for use by the end-user/consumer. + ACTIVE = 6; + + // The resources specified in the QueuedResource request are being + // deleted. This may have been initiated by the user, or + // the Cloud TPU service. Inspect the state data for more details. + SUSPENDING = 7; + + // The resources specified in the QueuedResource request have been + // deleted. + SUSPENDED = 8; + } + + // Further data for the creating state. + message CreatingData { + + } + + // Further data for the accepted state. + message AcceptedData { + + } + + // Further data for the provisioning state. + message ProvisioningData { + + } + + // Further data for the failed state. + message FailedData { + // The error that caused the queued resource to enter the FAILED state. + google.rpc.Status error = 1; + } + + // Further data for the deleting state. + message DeletingData { + + } + + // Further data for the active state. + message ActiveData { + + } + + // Further data for the suspending state. + message SuspendingData { + + } + + // Further data for the suspended state. + message SuspendedData { + + } + + // State of the QueuedResource request. + State state = 1; + + // Further data for the state. + oneof state_data { + // Further data for the creating state. + CreatingData creating_data = 2; + + // Further data for the accepted state. + AcceptedData accepted_data = 3; + + // Further data for the provisioning state. + ProvisioningData provisioning_data = 4; + + // Further data for the failed state. + FailedData failed_data = 5; + + // Further data for the deleting state. + DeletingData deleting_data = 6; + + // Further data for the active state. + ActiveData active_data = 7; + + // Further data for the suspending state. + SuspendingData suspending_data = 8; + + // Further data for the suspended state. + SuspendedData suspended_data = 9; + } +} + +// Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. +message ListNodesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Node" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. +message ListNodesResponse { + // The listed nodes. + repeated Node nodes = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetNode][google.cloud.tpu.v2alpha1.Tpu.GetNode]. +message GetNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [CreateNode][google.cloud.tpu.v2alpha1.Tpu.CreateNode]. +message CreateNodeRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; + + // Idempotent request UUID. + string request_id = 6; +} + +// Request for [DeleteNode][google.cloud.tpu.v2alpha1.Tpu.DeleteNode]. +message DeleteNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; + + // Idempotent request UUID. + string request_id = 3; +} + +// Request for [StopNode][google.cloud.tpu.v2alpha1.Tpu.StopNode]. +message StopNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [StartNode][google.cloud.tpu.v2alpha1.Tpu.StartNode]. +message StartNodeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; +} + +// Request for [UpdateNode][google.cloud.tpu.v2alpha1.Tpu.UpdateNode]. +message UpdateNodeRequest { + // Required. Mask of fields from [Node][Tpu.Node] to update. + // Supported fields: [description, tags, labels, metadata, + // network_config.enable_external_ips]. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The node. Only fields specified in update_mask are updated. + Node node = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. +message ListQueuedResourcesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/QueuedResource" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. +message ListQueuedResourcesResponse { + // The listed queued resources. + repeated QueuedResource queued_resources = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetQueuedResource][google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource] +message GetQueuedResourceRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/QueuedResource" + } + ]; +} + +// Request for [CreateQueuedResource][google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource]. +message CreateQueuedResourceRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + // regex format. + string queued_resource_id = 2; + + // Required. The queued resource. + QueuedResource queued_resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Idempotent request UUID. + string request_id = 4; +} + +// Request for [DeleteQueuedResource][google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource]. +message DeleteQueuedResourceRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/QueuedResource" + } + ]; + + // Idempotent request UUID. + string request_id = 2; +} + +// The per-product per-project service identity for Cloud TPU service. +message ServiceIdentity { + // The email address of the service identity. + string email = 1; +} + +// Request for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +message GenerateServiceIdentityResponse { + // ServiceIdentity that was created or retrieved. + ServiceIdentity identity = 1; +} + +// A accelerator type that a Node can be configured with. +message AcceleratorType { + option (google.api.resource) = { + type: "tpu.googleapis.com/AcceleratorType" + pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }; + + // The resource name. + string name = 1; + + // The accelerator type. + string type = 2; +} + +// Request for [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType]. +message GetAcceleratorTypeRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/AcceleratorType" + } + ]; +} + +// Request for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/AcceleratorType" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +message ListAcceleratorTypesResponse { + // The listed nodes. + repeated AcceleratorType accelerator_types = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// A runtime version that a Node can be configured with. +message RuntimeVersion { + option (google.api.resource) = { + type: "tpu.googleapis.com/RuntimeVersion" + pattern: "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" + }; + + // The resource name. + string name = 1; + + // The runtime version. + string version = 2; +} + +// Request for [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion]. +message GetRuntimeVersionRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/RuntimeVersion" + } + ]; +} + +// Request for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/RuntimeVersion" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; + + // List filter. + string filter = 5; + + // Sort results. + string order_by = 6; +} + +// Response for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +message ListRuntimeVersionsResponse { + // The listed nodes. + repeated RuntimeVersion runtime_versions = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} + +// A Symptom instance. +message Symptom { + // SymptomType represents the different types of Symptoms that a TPU can be + // at. + enum SymptomType { + // Unspecified symptom. + SYMPTOM_TYPE_UNSPECIFIED = 0; + + // TPU VM memory is low. + LOW_MEMORY = 1; + + // TPU runtime is out of memory. + OUT_OF_MEMORY = 2; + + // TPU runtime execution has timed out. + EXECUTE_TIMED_OUT = 3; + + // TPU runtime fails to construct a mesh that recognizes each TPU device's + // neighbors. + MESH_BUILD_FAIL = 4; + + // TPU HBM is out of memory. + HBM_OUT_OF_MEMORY = 5; + + // Abusive behaviors have been identified on the current project. + PROJECT_ABUSE = 6; + } + + // Timestamp when the Symptom is created. + google.protobuf.Timestamp create_time = 1; + + // Type of the Symptom. + SymptomType symptom_type = 2; + + // Detailed information of the current Symptom. + string details = 3; + + // A string used to uniquely distinguish a worker within a TPU node. + string worker_id = 4; +} + +// Request for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +message GetGuestAttributesRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; + + // The guest attributes path to be queried. + string query_path = 2; + + // The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + // returned. + repeated string worker_ids = 3; +} + +// Response for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +message GetGuestAttributesResponse { + // The guest attributes for the TPU workers. + repeated GuestAttributes guest_attributes = 1; +} + +// Request for [SimulateMaintenanceEvent][google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent]. +message SimulateMaintenanceEventRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; + + // The 0-based worker ID. If it is empty, worker ID 0 will be selected for + // maintenance event simulation. A maintenance event will only be fired on the + // first specified worker ID. Future implementations may support firing on + // multiple workers. + repeated string worker_ids = 2; +} + +// A set of Shielded Instance options. +message ShieldedInstanceConfig { + // Defines whether the instance has Secure Boot enabled. + bool enable_secure_boot = 1; +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json new file mode 100644 index 00000000000..839c736c173 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json @@ -0,0 +1,831 @@ +{ + "clientLibrary": { + "name": "nodejs-tpu", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.tpu.v2alpha1", + "version": "v2alpha1" + } + ] + }, + "snippets": [ + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListNodes_async", + "title": "Tpu listNodes Sample", + "origin": "API_DEFINITION", + "description": " Lists nodes.", + "canonical": true, + "file": "tpu.list_nodes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListNodes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListNodesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListNodes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetNode_async", + "title": "Tpu getNode Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a node.", + "canonical": true, + "file": "tpu.get_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.Node", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_CreateNode_async", + "title": "Tpu createNode Sample", + "origin": "API_DEFINITION", + "description": " Creates a node.", + "canonical": true, + "file": "tpu.create_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateNode", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "node_id", + "type": "TYPE_STRING" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2alpha1.Node" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_DeleteNode_async", + "title": "Tpu deleteNode Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node.", + "canonical": true, + "file": "tpu.delete_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_StopNode_async", + "title": "Tpu stopNode Sample", + "origin": "API_DEFINITION", + "description": " Stops a node. This operation is only available with single TPU nodes.", + "canonical": true, + "file": "tpu.stop_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.StopNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.StopNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_StartNode_async", + "title": "Tpu startNode Sample", + "origin": "API_DEFINITION", + "description": " Starts a node.", + "canonical": true, + "file": "tpu.start_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.StartNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.StartNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_UpdateNode_async", + "title": "Tpu updateNode Sample", + "origin": "API_DEFINITION", + "description": " Updates the configurations of a node.", + "canonical": true, + "file": "tpu.update_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.UpdateNode", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2alpha1.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.UpdateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListQueuedResources_async", + "title": "Tpu listQueuedResources Sample", + "origin": "API_DEFINITION", + "description": " Lists queued resources.", + "canonical": true, + "file": "tpu.list_queued_resources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListQueuedResources", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListQueuedResources", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetQueuedResource_async", + "title": "Tpu getQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a queued resource.", + "canonical": true, + "file": "tpu.get_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.QueuedResource", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async", + "title": "Tpu createQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Creates a QueuedResource TPU instance.", + "canonical": true, + "file": "tpu.create_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "queued_resource_id", + "type": "TYPE_STRING" + }, + { + "name": "queued_resource", + "type": ".google.cloud.tpu.v2alpha1.QueuedResource" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "CreateQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async", + "title": "Tpu deleteQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Deletes a QueuedResource TPU instance.", + "canonical": true, + "file": "tpu.delete_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "DeleteQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async", + "title": "Tpu generateServiceIdentity Sample", + "origin": "API_DEFINITION", + "description": " Generates the Cloud TPU service identity for the project.", + "canonical": true, + "file": "tpu.generate_service_identity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async", + "title": "Tpu listAcceleratorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists accelerator types supported by this API.", + "canonical": true, + "file": "tpu.list_accelerator_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async", + "title": "Tpu getAcceleratorType Sample", + "origin": "API_DEFINITION", + "description": " Gets AcceleratorType.", + "canonical": true, + "file": "tpu.get_accelerator_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.AcceleratorType", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async", + "title": "Tpu listRuntimeVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists runtime versions supported by this API.", + "canonical": true, + "file": "tpu.list_runtime_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async", + "title": "Tpu getRuntimeVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a runtime version.", + "canonical": true, + "file": "tpu.get_runtime_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.RuntimeVersion", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async", + "title": "Tpu getGuestAttributes Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the guest attributes for the node.", + "canonical": true, + "file": "tpu.get_guest_attributes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "query_path", + "type": "TYPE_STRING" + }, + { + "name": "worker_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async", + "title": "Tpu simulateMaintenanceEvent Sample", + "origin": "API_DEFINITION", + "description": " Simulates a maintenance event.", + "canonical": true, + "file": "tpu.simulate_maintenance_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SimulateMaintenanceEvent", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "worker_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "SimulateMaintenanceEvent", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js new file mode 100644 index 00000000000..98e5bbe23b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, node) { + // [START tpu_v2alpha1_generated_Tpu_CreateNode_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 name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. + */ + // const nodeId = 'abc123' + /** + * Required. The node. + */ + // const node = {} + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callCreateNode() { + // Construct request + const request = { + parent, + node, + }; + + // Run request + const [operation] = await tpuClient.createNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateNode(); + // [END tpu_v2alpha1_generated_Tpu_CreateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js new file mode 100644 index 00000000000..ce18949212b --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, queuedResource) { + // [START tpu_v2alpha1_generated_Tpu_CreateQueuedResource_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 name. + */ + // const parent = 'abc123' + /** + * The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + * regex format. + */ + // const queuedResourceId = 'abc123' + /** + * Required. The queued resource. + */ + // const queuedResource = {} + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callCreateQueuedResource() { + // Construct request + const request = { + parent, + queuedResource, + }; + + // Run request + const [operation] = await tpuClient.createQueuedResource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateQueuedResource(); + // [END tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js new file mode 100644 index 00000000000..694da219d05 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_DeleteNode_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. + */ + // const name = 'abc123' + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callDeleteNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteNode(); + // [END tpu_v2alpha1_generated_Tpu_DeleteNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js new file mode 100644 index 00000000000..de8b02c722c --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_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. + */ + // const name = 'abc123' + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callDeleteQueuedResource() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.deleteQueuedResource(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteQueuedResource(); + // [END tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js new file mode 100644 index 00000000000..6120c836015 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_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 name. + */ + // const parent = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGenerateServiceIdentity() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await tpuClient.generateServiceIdentity(request); + console.log(response); + } + + callGenerateServiceIdentity(); + // [END tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js new file mode 100644 index 00000000000..c09ba898d76 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetAcceleratorType_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetAcceleratorType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getAcceleratorType(request); + console.log(response); + } + + callGetAcceleratorType(); + // [END tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js new file mode 100644 index 00000000000..e6b83bcafac --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetGuestAttributes_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. + */ + // const name = 'abc123' + /** + * The guest attributes path to be queried. + */ + // const queryPath = 'abc123' + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + */ + // const workerIds = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetGuestAttributes() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getGuestAttributes(request); + console.log(response); + } + + callGetGuestAttributes(); + // [END tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js new file mode 100644 index 00000000000..ad9a1a2c833 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetNode() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getNode(request); + console.log(response); + } + + callGetNode(); + // [END tpu_v2alpha1_generated_Tpu_GetNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js new file mode 100644 index 00000000000..515f190b9cf --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetQueuedResource_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetQueuedResource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getQueuedResource(request); + console.log(response); + } + + callGetQueuedResource(); + // [END tpu_v2alpha1_generated_Tpu_GetQueuedResource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js new file mode 100644 index 00000000000..8b9a3ee8556 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callGetRuntimeVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await tpuClient.getRuntimeVersion(request); + console.log(response); + } + + callGetRuntimeVersion(); + // [END tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js new file mode 100644 index 00000000000..bbaeacf2d0d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListAcceleratorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listAcceleratorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAcceleratorTypes(); + // [END tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js new file mode 100644 index 00000000000..4a43bdcc192 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListNodes_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListNodes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listNodesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNodes(); + // [END tpu_v2alpha1_generated_Tpu_ListNodes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js new file mode 100644 index 00000000000..43e5a580fb4 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListQueuedResources_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListQueuedResources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listQueuedResourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListQueuedResources(); + // [END tpu_v2alpha1_generated_Tpu_ListQueuedResources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js new file mode 100644 index 00000000000..ba51c03858c --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_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 name. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * List filter. + */ + // const filter = 'abc123' + /** + * Sort results. + */ + // const orderBy = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callListRuntimeVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await tpuClient.listRuntimeVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRuntimeVersions(); + // [END tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js new file mode 100644 index 00000000000..cdb60fed96d --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_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. + */ + // const name = 'abc123' + /** + * The 0-based worker ID. If it is empty, worker ID 0 will be selected for + * maintenance event simulation. A maintenance event will only be fired on the + * first specified worker ID. Future implementations may support firing on + * multiple workers. + */ + // const workerIds = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callSimulateMaintenanceEvent() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.simulateMaintenanceEvent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSimulateMaintenanceEvent(); + // [END tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js new file mode 100644 index 00000000000..a1f1418e8a4 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_StartNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStartNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.startNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStartNode(); + // [END tpu_v2alpha1_generated_Tpu_StartNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js new file mode 100644 index 00000000000..57304cc5003 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START tpu_v2alpha1_generated_Tpu_StopNode_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. + */ + // const name = 'abc123' + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callStopNode() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await tpuClient.stopNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callStopNode(); + // [END tpu_v2alpha1_generated_Tpu_StopNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js new file mode 100644 index 00000000000..642d3f00743 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, node) { + // [START tpu_v2alpha1_generated_Tpu_UpdateNode_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. Mask of fields from Node Tpu.Node to update. + * Supported fields: description, tags, labels, metadata, + * network_config.enable_external_ips. + */ + // const updateMask = {} + /** + * Required. The node. Only fields specified in update_mask are updated. + */ + // const node = {} + + // Imports the Tpu library + const {TpuClient} = require('@google-cloud/tpu').v2alpha1; + + // Instantiates a client + const tpuClient = new TpuClient(); + + async function callUpdateNode() { + // Construct request + const request = { + updateMask, + node, + }; + + // Run request + const [operation] = await tpuClient.updateNode(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateNode(); + // [END tpu_v2alpha1_generated_Tpu_UpdateNode_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts new file mode 100644 index 00000000000..e00ff687292 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v2alpha1 from './v2alpha1'; +const TpuClient = v2alpha1.TpuClient; +type TpuClient = v2alpha1.TpuClient; +export {v2alpha1, TpuClient}; +export default {v2alpha1, TpuClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json new file mode 100644 index 00000000000..521ba0b7c56 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json @@ -0,0 +1,219 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.tpu.v2alpha1", + "libraryPackage": "@google-cloud/tpu", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GetQueuedResource": { + "methods": [ + "getQueuedResource" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "CreateQueuedResource": { + "methods": [ + "createQueuedResource" + ] + }, + "DeleteQueuedResource": { + "methods": [ + "deleteQueuedResource" + ] + }, + "SimulateMaintenanceEvent": { + "methods": [ + "simulateMaintenanceEvent" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListQueuedResources": { + "methods": [ + "listQueuedResources", + "listQueuedResourcesStream", + "listQueuedResourcesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TpuClient", + "rpcs": { + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GetQueuedResource": { + "methods": [ + "getQueuedResource" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "CreateQueuedResource": { + "methods": [ + "createQueuedResource" + ] + }, + "DeleteQueuedResource": { + "methods": [ + "deleteQueuedResource" + ] + }, + "SimulateMaintenanceEvent": { + "methods": [ + "simulateMaintenanceEvent" + ] + }, + "ListNodes": { + "methods": [ + "listNodes", + "listNodesStream", + "listNodesAsync" + ] + }, + "ListQueuedResources": { + "methods": [ + "listQueuedResources", + "listQueuedResourcesStream", + "listQueuedResourcesAsync" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes", + "listAcceleratorTypesStream", + "listAcceleratorTypesAsync" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions", + "listRuntimeVersionsStream", + "listRuntimeVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts new file mode 100644 index 00000000000..27c81814923 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {TpuClient} from './tpu_client'; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts new file mode 100644 index 00000000000..b7a8e23d255 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts @@ -0,0 +1,2862 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/v2alpha1/tpu_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tpu_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages TPU nodes and other resources + * + * TPU API v2alpha1 + * @class + * @memberof v2alpha1 + */ +export class TpuClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tpuStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TpuClient. + * + * @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 TpuClient({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 TpuClient; + 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.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 = { + acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodes/{node}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + queuedResourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/queuedResources/{queued_resource}' + ), + runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' + ), + }; + + // 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 = { + listNodes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), + listQueuedResources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'queuedResources'), + listAcceleratorTypes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes'), + listRuntimeVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'runtimeVersions') + }; + + 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.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*}',},{get: '/v2/{name=projects/*/locations/*}',}], + },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=projects/*}/locations',},{get: '/v2alpha1/{name=projects/*}/locations',},{get: '/v2/{name=projects/*}/locations',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}/operations',},{get: '/v2alpha1/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; + const createNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteNodeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const stopNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; + const stopNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const startNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; + const startNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const updateNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; + const updateNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const createQueuedResourceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.QueuedResource') as gax.protobuf.Type; + const createQueuedResourceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteQueuedResourceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.QueuedResource') as gax.protobuf.Type; + const deleteQueuedResourceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + const simulateMaintenanceEventResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; + const simulateMaintenanceEventMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeResponse.decode.bind(createNodeResponse), + createNodeMetadata.decode.bind(createNodeMetadata)), + deleteNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNodeResponse.decode.bind(deleteNodeResponse), + deleteNodeMetadata.decode.bind(deleteNodeMetadata)), + stopNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopNodeResponse.decode.bind(stopNodeResponse), + stopNodeMetadata.decode.bind(stopNodeMetadata)), + startNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startNodeResponse.decode.bind(startNodeResponse), + startNodeMetadata.decode.bind(startNodeMetadata)), + updateNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateNodeResponse.decode.bind(updateNodeResponse), + updateNodeMetadata.decode.bind(updateNodeMetadata)), + createQueuedResource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createQueuedResourceResponse.decode.bind(createQueuedResourceResponse), + createQueuedResourceMetadata.decode.bind(createQueuedResourceMetadata)), + deleteQueuedResource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteQueuedResourceResponse.decode.bind(deleteQueuedResourceResponse), + deleteQueuedResourceMetadata.decode.bind(deleteQueuedResourceMetadata)), + simulateMaintenanceEvent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + simulateMaintenanceEventResponse.decode.bind(simulateMaintenanceEventResponse), + simulateMaintenanceEventMetadata.decode.bind(simulateMaintenanceEventMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.tpu.v2alpha1.Tpu', 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.tpuStub) { + return this.tpuStub; + } + + // Put together the "service stub" for + // google.cloud.tpu.v2alpha1.Tpu. + this.tpuStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v2alpha1.Tpu') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.tpu.v2alpha1.Tpu, + 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 tpuStubMethods = + ['listNodes', 'getNode', 'createNode', 'deleteNode', 'stopNode', 'startNode', 'updateNode', 'listQueuedResources', 'getQueuedResource', 'createQueuedResource', 'deleteQueuedResource', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes', 'simulateMaintenanceEvent']; + for (const methodName of tpuStubMethods) { + const callPromise = this.tpuStub.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.tpuStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'tpu.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 'tpu.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 the details of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. + * 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/v2alpha1/tpu.get_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetNode_async + */ + getNode( + request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|undefined, {}|undefined + ]>; + getNode( + request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, + {}|null|undefined>): void; + getNode( + request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|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.getNode(request, options, callback); + } +/** + * Gets details of a queued resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. + * 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/v2alpha1/tpu.get_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetQueuedResource_async + */ + getQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|undefined, {}|undefined + ]>; + getQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, + {}|null|undefined>): void; + getQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, + {}|null|undefined>): void; + getQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|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.getQueuedResource(request, options, callback); + } +/** + * Generates the Cloud TPU service identity for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @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 [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse}. + * 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/v2alpha1/tpu.generate_service_identity.js + * region_tag:tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async + */ + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|undefined, {}|undefined + ]>; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): void; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): void; + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|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.generateServiceIdentity(request, options, callback); + } +/** + * Gets AcceleratorType. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. + * 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/v2alpha1/tpu.get_accelerator_type.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async + */ + getAcceleratorType( + request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|undefined, {}|undefined + ]>; + getAcceleratorType( + request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): void; + getAcceleratorType( + request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType, + protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); + } +/** + * Gets a runtime version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. + * 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/v2alpha1/tpu.get_runtime_version.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async + */ + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|undefined, {}|undefined + ]>; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): void; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): void; + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, + protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|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.getRuntimeVersion(request, options, callback); + } +/** + * Retrieves the guest attributes for the node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.queryPath + * The guest attributes path to be queried. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, all workers' GuestAttributes 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 [GetGuestAttributesResponse]{@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse}. + * 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/v2alpha1/tpu.get_guest_attributes.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async + */ + getGuestAttributes( + request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|undefined, {}|undefined + ]>; + getGuestAttributes( + request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): void; + getGuestAttributes( + request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): void; + getGuestAttributes( + request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|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.getGuestAttributes(request, options, callback); + } + +/** + * Creates a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.nodeId + * The unqualified resource name. + * @param {google.cloud.tpu.v2alpha1.Node} request.node + * Required. The node. + * @param {string} request.requestId + * Idempotent request UUID. + * @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/v2alpha1/tpu.create_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateNode_async + */ + createNode( + request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createNode( + request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createNode( + request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, + 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.createNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createNode()`. + * @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/v2alpha1/tpu.create_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateNode_async + */ + async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.requestId + * Idempotent request UUID. + * @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/v2alpha1/tpu.delete_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteNode_async + */ + deleteNode( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteNode( + request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteNode( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, + 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.deleteNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteNode()`. + * @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/v2alpha1/tpu.delete_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteNode_async + */ + async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Stops a node. This operation is only available with single TPU nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/v2alpha1/tpu.stop_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_StopNode_async + */ + stopNode( + request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + stopNode( + request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + stopNode( + request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, + 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.stopNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `stopNode()`. + * @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/v2alpha1/tpu.stop_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_StopNode_async + */ + async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Starts a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/v2alpha1/tpu.start_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_StartNode_async + */ + startNode( + request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + startNode( + request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + startNode( + request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, + 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.startNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `startNode()`. + * @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/v2alpha1/tpu.start_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_StartNode_async + */ + async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the configurations of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields from {@link Tpu.Node|Node} to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * @param {google.cloud.tpu.v2alpha1.Node} request.node + * Required. The node. Only fields specified in update_mask are updated. + * @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/v2alpha1/tpu.update_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_UpdateNode_async + */ + updateNode( + request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateNode( + request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNode( + request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateNode( + request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, + 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({ + 'node.name': request.node!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNode(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateNode()`. + * @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/v2alpha1/tpu.update_node.js + * region_tag:tpu_v2alpha1_generated_Tpu_UpdateNode_async + */ + async checkUpdateNodeProgress(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.updateNode, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a QueuedResource TPU instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.queuedResourceId + * The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + * regex format. + * @param {google.cloud.tpu.v2alpha1.QueuedResource} request.queuedResource + * Required. The queued resource. + * @param {string} request.requestId + * Idempotent request UUID. + * @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/v2alpha1/tpu.create_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async + */ + createQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, + 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.createQueuedResource(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createQueuedResource()`. + * @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/v2alpha1/tpu.create_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async + */ + async checkCreateQueuedResourceProgress(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.createQueuedResource, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a QueuedResource TPU instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.requestId + * Idempotent request UUID. + * @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/v2alpha1/tpu.delete_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async + */ + deleteQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + 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.deleteQueuedResource(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteQueuedResource()`. + * @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/v2alpha1/tpu.delete_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async + */ + async checkDeleteQueuedResourceProgress(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.deleteQueuedResource, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Simulates a maintenance event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, worker ID 0 will be selected for + * maintenance event simulation. A maintenance event will only be fired on the + * first specified worker ID. Future implementations may support firing on + * multiple workers. + * @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/v2alpha1/tpu.simulate_maintenance_event.js + * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async + */ + simulateMaintenanceEvent( + request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + simulateMaintenanceEvent( + request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + simulateMaintenanceEvent( + request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + simulateMaintenanceEvent( + request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + 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.simulateMaintenanceEvent(request, options, callback); + } +/** + * Check the status of the long running operation returned by `simulateMaintenanceEvent()`. + * @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/v2alpha1/tpu.simulate_maintenance_event.js + * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async + */ + async checkSimulateMaintenanceEventProgress(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.simulateMaintenanceEvent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ]>; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.INode>): void; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.INode>): void; + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.INode>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.INode>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ]>|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.listNodes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNodes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v2alpha1.Node}. 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/v2alpha1/tpu.list_nodes.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListNodes_async + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists queued resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. + * 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 `listQueuedResourcesAsync()` + * 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. + */ + listQueuedResources( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IQueuedResource[], + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + ]>; + listQueuedResources( + request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource>): void; + listQueuedResources( + request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource>): void; + listQueuedResources( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IQueuedResource[], + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + ]>|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.listQueuedResources(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource} 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 `listQueuedResourcesAsync()` + * 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. + */ + listQueuedResourcesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + 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['listQueuedResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQueuedResources.createStream( + this.innerApiCalls.listQueuedResources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listQueuedResources`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. 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/v2alpha1/tpu.list_queued_resources.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListQueuedResources_async + */ + listQueuedResourcesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + 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['listQueuedResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQueuedResources.asyncIterate( + this.innerApiCalls['listQueuedResources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists accelerator types supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. + * 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + ]>; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): void; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): void; + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest|null, + protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse + ]>|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.listAcceleratorTypes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType} 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.createStream( + this.innerApiCalls.listAcceleratorTypes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAcceleratorTypes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. 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/v2alpha1/tpu.list_accelerator_types.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async + */ + listAcceleratorTypesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.asyncIterate( + this.innerApiCalls['listAcceleratorTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists runtime versions supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. + * 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest|null, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + ]>; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): void; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): void; + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): + Promise<[ + protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest|null, + protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse + ]>|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.listRuntimeVersions(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion} 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersionsStream( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.createStream( + this.innerApiCalls.listRuntimeVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRuntimeVersions`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. 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/v2alpha1/tpu.list_runtime_versions.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async + */ + listRuntimeVersionsAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.asyncIterate( + this.innerApiCalls['listRuntimeVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * 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 [Location]{@link google.cloud.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 + * [Location]{@link google.cloud.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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} accelerator_type + * @returns {string} Resource name string. + */ + acceleratorTypePath(project:string,location:string,acceleratorType:string) { + return this.pathTemplates.acceleratorTypePathTemplate.render({ + project: project, + location: location, + accelerator_type: acceleratorType, + }); + } + + /** + * Parse the project from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; + } + + /** + * Parse the location from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; + } + + /** + * Parse the accelerator_type from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the accelerator_type. + */ + matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; + } + + /** + * 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 node resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node + * @returns {string} Resource name string. + */ + nodePath(project:string,location:string,node:string) { + return this.pathTemplates.nodePathTemplate.render({ + project: project, + location: location, + node: node, + }); + } + + /** + * Parse the project from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).project; + } + + /** + * Parse the location from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).location; + } + + /** + * Parse the node from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the node. + */ + matchNodeFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).node; + } + + /** + * 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 queuedResource resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} queued_resource + * @returns {string} Resource name string. + */ + queuedResourcePath(project:string,location:string,queuedResource:string) { + return this.pathTemplates.queuedResourcePathTemplate.render({ + project: project, + location: location, + queued_resource: queuedResource, + }); + } + + /** + * Parse the project from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the project. + */ + matchProjectFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).project; + } + + /** + * Parse the location from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the location. + */ + matchLocationFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).location; + } + + /** + * Parse the queued_resource from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the queued_resource. + */ + matchQueuedResourceFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).queued_resource; + } + + /** + * Return a fully-qualified runtimeVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} runtime_version + * @returns {string} Resource name string. + */ + runtimeVersionPath(project:string,location:string,runtimeVersion:string) { + return this.pathTemplates.runtimeVersionPathTemplate.render({ + project: project, + location: location, + runtime_version: runtimeVersion, + }); + } + + /** + * Parse the project from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).project; + } + + /** + * Parse the location from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).location; + } + + /** + * Parse the runtime_version from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the runtime_version. + */ + matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).runtime_version; + } + + /** + * 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.tpuStub && !this._terminated) { + return this.tpuStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json new file mode 100644 index 00000000000..5adc5503d1e --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json @@ -0,0 +1,116 @@ +{ + "interfaces": { + "google.cloud.tpu.v2alpha1.Tpu": { + "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": { + "ListNodes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNode": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListQueuedResources": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateServiceIdentity": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAcceleratorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetAcceleratorType": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimeVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRuntimeVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetGuestAttributes": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SimulateMaintenanceEvent": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json new file mode 100644 index 00000000000..17217f28408 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto" +] diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..9cb87c17e68 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const tpu = require('@google-cloud/tpu'); + +function main() { + const tpuClient = new tpu.TpuClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..50ac473b84f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {TpuClient} from '@google-cloud/tpu'; + +// check that the client class type name can be used +function doStuffWithTpuClient(client: TpuClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const tpuClient = new TpuClient(); + doStuffWithTpuClient(tpuClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts new file mode 100644 index 00000000000..60380c5a6e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts @@ -0,0 +1,3753 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as tpuModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, 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('v2alpha1.TpuClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v2alpha1.TpuClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v2alpha1.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tpuModule.v2alpha1.TpuClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tpuModule.v2alpha1.TpuClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v2alpha1.TpuClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); + }); + + it('has close method for the initialized client', done => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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('getNode', () => { + it('invokes getNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.Node() + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.Node() + ); + client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.INode|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + const actualRequest = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNode(request), expectedError); + }); + }); + + describe('getQueuedResource', () => { + it('invokes getQueuedResource without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ); + client.innerApiCalls.getQueuedResource = stubSimpleCall(expectedResponse); + const [response] = await client.getQueuedResource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ); + client.innerApiCalls.getQueuedResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getQueuedResource( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getQueuedResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getQueuedResource(request), expectedError); + const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getQueuedResource(request), expectedError); + }); + }); + + describe('generateServiceIdentity', () => { + it('invokes generateServiceIdentity without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall(expectedResponse); + const [response] = await client.generateServiceIdentity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateServiceIdentity( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateServiceIdentity(request), expectedError); + const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateServiceIdentity(request), expectedError); + }); + }); + + describe('getAcceleratorType', () => { + it('invokes getAcceleratorType without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); + const [response] = await client.getAcceleratorType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAcceleratorType( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAcceleratorType(request), expectedError); + const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAcceleratorType(request), expectedError); + }); + }); + + describe('getRuntimeVersion', () => { + it('invokes getRuntimeVersion without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getRuntimeVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRuntimeVersion( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + }); + }); + + describe('getGuestAttributes', () => { + it('invokes getGuestAttributes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = stubSimpleCall(expectedResponse); + const [response] = await client.getGuestAttributes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGuestAttributes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGuestAttributes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGuestAttributes(request), expectedError); + const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGuestAttributes(request), expectedError); + }); + }); + + describe('createNode', () => { + it('invokes createNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNode( + 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.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createNode(request), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkCreateNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkCreateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteNode', () => { + it('invokes deleteNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNode( + 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.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteNode(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('stopNode', () => { + it('invokes stopNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopNode( + 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.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.stopNode(request), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.stopNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkStopNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkStopNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('startNode', () => { + it('invokes startNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.startNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startNode( + 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.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.startNode(request), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.startNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkStartNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkStartNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateNode', () => { + it('invokes updateNode without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNode( + 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.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateNode(request), expectedError); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateNodeProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkUpdateNodeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateNodeProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkUpdateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createQueuedResource', () => { + it('invokes createQueuedResource without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createQueuedResource = stubLongRunningCall(expectedResponse); + const [operation] = await client.createQueuedResource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQueuedResource without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createQueuedResource = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createQueuedResource( + 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.createQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQueuedResource with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createQueuedResource = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createQueuedResource(request), expectedError); + const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQueuedResource with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createQueuedResource = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createQueuedResource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateQueuedResourceProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkCreateQueuedResourceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateQueuedResourceProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkCreateQueuedResourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteQueuedResource', () => { + it('invokes deleteQueuedResource without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteQueuedResource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteQueuedResource( + 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.deleteQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteQueuedResource(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteQueuedResource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteQueuedResourceProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteQueuedResourceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteQueuedResourceProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteQueuedResourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('simulateMaintenanceEvent', () => { + it('invokes simulateMaintenanceEvent without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(expectedResponse); + const [operation] = await client.simulateMaintenanceEvent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.simulateMaintenanceEvent( + 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.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.simulateMaintenanceEvent(request), expectedError); + const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.simulateMaintenanceEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSimulateMaintenanceEventProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkSimulateMaintenanceEventProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSimulateMaintenanceEventProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkSimulateMaintenanceEventProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.INode[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listQueuedResources', () => { + it('invokes listQueuedResources without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + ]; + client.innerApiCalls.listQueuedResources = stubSimpleCall(expectedResponse); + const [response] = await client.listQueuedResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResources without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + ]; + client.innerApiCalls.listQueuedResources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listQueuedResources( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResources with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listQueuedResources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listQueuedResources(request), expectedError); + const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResourcesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + ]; + client.descriptors.page.listQueuedResources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listQueuedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { + 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.listQueuedResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listQueuedResources, request)); + assert( + (client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listQueuedResourcesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQueuedResources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listQueuedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listQueuedResources, request)); + assert( + (client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listQueuedResources without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), + ]; + client.descriptors.page.listQueuedResources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = []; + const iterable = client.listQueuedResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listQueuedResources with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQueuedResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listQueuedResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimeVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimeVersions( + request, + (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRuntimeVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersionsStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + 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.listRuntimeVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRuntimeVersionsStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRuntimeVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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('acceleratorType', () => { + const fakePath = "/rendered/path/acceleratorType"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + accelerator_type: "acceleratorTypeValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.acceleratorTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.acceleratorTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('acceleratorTypePath', () => { + const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAcceleratorTypeName', () => { + const result = client.matchProjectFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAcceleratorTypeName', () => { + const result = client.matchLocationFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAcceleratorTypeFromAcceleratorTypeName', () => { + const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, "acceleratorTypeValue"); + assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + 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('node', () => { + const fakePath = "/rendered/path/node"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + node: "nodeValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.nodePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath("projectValue", "locationValue", "nodeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, "nodeValue"); + assert((client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + 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('queuedResource', () => { + const fakePath = "/rendered/path/queuedResource"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + queued_resource: "queuedResourceValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.queuedResourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.queuedResourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('queuedResourcePath', () => { + const result = client.queuedResourcePath("projectValue", "locationValue", "queuedResourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.queuedResourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromQueuedResourceName', () => { + const result = client.matchProjectFromQueuedResourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromQueuedResourceName', () => { + const result = client.matchLocationFromQueuedResourceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchQueuedResourceFromQueuedResourceName', () => { + const result = client.matchQueuedResourceFromQueuedResourceName(fakePath); + assert.strictEqual(result, "queuedResourceValue"); + assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('runtimeVersion', () => { + const fakePath = "/rendered/path/runtimeVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + runtime_version: "runtimeVersionValue", + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.runtimeVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.runtimeVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('runtimeVersionPath', () => { + const result = client.runtimeVersionPath("projectValue", "locationValue", "runtimeVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRuntimeVersionName', () => { + const result = client.matchProjectFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRuntimeVersionName', () => { + const result = client.matchLocationFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRuntimeVersionFromRuntimeVersionName', () => { + const result = client.matchRuntimeVersionFromRuntimeVersionName(fakePath); + assert.strictEqual(result, "runtimeVersionValue"); + assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/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-cloud-tpu/v2alpha1/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/webpack.config.js new file mode 100644 index 00000000000..8ee514d072f --- /dev/null +++ b/owl-bot-staging/google-cloud-tpu/v2alpha1/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: 'Tpu', + filename: './tpu.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 817416a12553c21172d16770ea473d5221e58be5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 6 Dec 2022 19:57:06 +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 --- .../google-cloud-tpu/v1/.eslintignore | 7 - .../google-cloud-tpu/v1/.eslintrc.json | 3 - .../google-cloud-tpu/v1/.gitignore | 14 - owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js | 55 - .../google-cloud-tpu/v1/.mocharc.js | 33 - .../google-cloud-tpu/v1/.prettierrc.js | 22 - owl-bot-staging/google-cloud-tpu/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../google-cloud-tpu/v1/package.json | 64 - .../google/cloud/tpu/v1/cloud_tpu.proto | 617 - .../snippet_metadata.google.cloud.tpu.v1.json | 507 - .../samples/generated/v1/tpu.create_node.js | 71 - .../samples/generated/v1/tpu.delete_node.js | 62 - .../generated/v1/tpu.get_accelerator_type.js | 61 - .../v1/samples/generated/v1/tpu.get_node.js | 61 - .../v1/tpu.get_tensor_flow_version.js | 61 - .../v1/tpu.list_accelerator_types.js | 79 - .../v1/samples/generated/v1/tpu.list_nodes.js | 71 - .../v1/tpu.list_tensor_flow_versions.js | 79 - .../samples/generated/v1/tpu.reimage_node.js | 65 - .../v1/samples/generated/v1/tpu.start_node.js | 61 - .../v1/samples/generated/v1/tpu.stop_node.js | 61 - .../google-cloud-tpu/v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 145 - .../google-cloud-tpu/v1/src/v1/tpu_client.ts | 2094 -- .../v1/src/v1/tpu_client_config.json | 81 - .../v1/src/v1/tpu_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../google-cloud-tpu/v1/test/gapic_tpu_v1.ts | 2672 --- .../google-cloud-tpu/v1/tsconfig.json | 19 - .../google-cloud-tpu/v1/webpack.config.js | 64 - .../google-cloud-tpu/v2/.eslintignore | 7 - .../google-cloud-tpu/v2/.eslintrc.json | 3 - .../google-cloud-tpu/v2/.gitignore | 14 - owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js | 55 - .../google-cloud-tpu/v2/.mocharc.js | 33 - .../google-cloud-tpu/v2/.prettierrc.js | 22 - owl-bot-staging/google-cloud-tpu/v2/README.md | 1 - .../v2/linkinator.config.json | 16 - .../google-cloud-tpu/v2/package.json | 64 - .../snippet_metadata.google.cloud.tpu.v2.json | 595 - .../google-cloud-tpu/v2/src/index.ts | 25 - .../google-cloud-tpu/v2/src/v2/index.ts | 19 - .../google-cloud-tpu/v2/src/v2/tpu_client.ts | 2249 -- .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2/system-test/install.ts | 49 - .../google-cloud-tpu/v2/test/gapic_tpu_v2.ts | 2892 --- .../google-cloud-tpu/v2/tsconfig.json | 19 - .../google-cloud-tpu/v2/webpack.config.js | 64 - .../google-cloud-tpu/v2alpha1/.eslintignore | 7 - .../google-cloud-tpu/v2alpha1/.eslintrc.json | 3 - .../google-cloud-tpu/v2alpha1/.gitignore | 14 - .../google-cloud-tpu/v2alpha1/.jsdoc.js | 55 - .../google-cloud-tpu/v2alpha1/.mocharc.js | 33 - .../google-cloud-tpu/v2alpha1/.prettierrc.js | 22 - .../google-cloud-tpu/v2alpha1/README.md | 1 - .../v2alpha1/linkinator.config.json | 16 - .../google-cloud-tpu/v2alpha1/package.json | 64 - .../google/cloud/tpu/v2alpha1/cloud_tpu.proto | 1169 - ...et_metadata.google.cloud.tpu.v2alpha1.json | 831 - .../generated/v2alpha1/tpu.create_node.js | 75 - .../generated/v2alpha1/tpu.delete_node.js | 66 - .../v2alpha1/tpu.generate_service_identity.js | 61 - .../v2alpha1/tpu.get_accelerator_type.js | 61 - .../v2alpha1/tpu.get_guest_attributes.js | 70 - .../generated/v2alpha1/tpu.get_node.js | 61 - .../v2alpha1/tpu.get_runtime_version.js | 61 - .../v2alpha1/tpu.list_accelerator_types.js | 79 - .../generated/v2alpha1/tpu.list_nodes.js | 71 - .../v2alpha1/tpu.list_runtime_versions.js | 79 - .../generated/v2alpha1/tpu.start_node.js | 62 - .../generated/v2alpha1/tpu.stop_node.js | 62 - .../generated/v2alpha1/tpu.update_node.js | 69 - .../google-cloud-tpu/v2alpha1/src/index.ts | 25 - .../v2alpha1/src/v2alpha1/gapic_metadata.json | 219 - .../v2alpha1/src/v2alpha1/index.ts | 19 - .../v2alpha1/src/v2alpha1/tpu_client.ts | 2862 --- .../src/v2alpha1/tpu_client_config.json | 116 - .../v2alpha1/src/v2alpha1/tpu_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v2alpha1/system-test/install.ts | 49 - .../v2alpha1/test/gapic_tpu_v2alpha1.ts | 3753 --- .../google-cloud-tpu/v2alpha1/tsconfig.json | 19 - .../v2alpha1/webpack.config.js | 64 - packages/google-cloud-tpu/README.md | 18 + .../google/cloud/tpu/v2/cloud_tpu.proto | 0 .../google/cloud/tpu/v2alpha1/cloud_tpu.proto | 548 +- packages/google-cloud-tpu/protos/protos.d.ts | 7384 +++++- packages/google-cloud-tpu/protos/protos.js | 18786 ++++++++++++++-- packages/google-cloud-tpu/protos/protos.json | 1694 +- packages/google-cloud-tpu/samples/README.md | 324 + .../snippet_metadata.google.cloud.tpu.v2.json | 595 + .../samples/generated/v2/tpu.create_node.js | 0 .../samples/generated/v2/tpu.delete_node.js | 0 .../v2/tpu.generate_service_identity.js | 0 .../generated/v2/tpu.get_accelerator_type.js | 0 .../generated/v2/tpu.get_guest_attributes.js | 0 .../samples/generated/v2/tpu.get_node.js | 0 .../generated/v2/tpu.get_runtime_version.js | 0 .../v2/tpu.list_accelerator_types.js | 0 .../samples/generated/v2/tpu.list_nodes.js | 0 .../generated/v2/tpu.list_runtime_versions.js | 0 .../samples/generated/v2/tpu.start_node.js | 0 .../samples/generated/v2/tpu.stop_node.js | 0 .../samples/generated/v2/tpu.update_node.js | 0 ...et_metadata.google.cloud.tpu.v2alpha1.json | 246 +- .../generated/v2alpha1/tpu.create_node.js | 4 + .../v2alpha1/tpu.create_queued_resource.js | 0 .../generated/v2alpha1/tpu.delete_node.js | 4 + .../v2alpha1/tpu.delete_queued_resource.js | 0 .../v2alpha1/tpu.get_queued_resource.js | 0 .../v2alpha1/tpu.list_queued_resources.js | 0 .../tpu.simulate_maintenance_event.js | 0 .../generated/v2alpha1/tpu.start_node.js | 5 +- .../generated/v2alpha1/tpu.stop_node.js | 5 +- .../generated/v2alpha1/tpu.update_node.js | 3 +- packages/google-cloud-tpu/src/index.ts | 5 +- .../google-cloud-tpu/src/v1/tpu_client.ts | 3 + .../src/v2/gapic_metadata.json | 0 .../google-cloud-tpu/src/v2}/index.ts | 0 .../google-cloud-tpu/src/v2/tpu_client.ts | 2735 +++ .../src/v2/tpu_client_config.json | 0 .../src/v2/tpu_proto_list.json | 0 .../src/v2alpha1/gapic_metadata.json | 54 + .../src/v2alpha1/tpu_client.ts | 1358 +- .../src/v2alpha1/tpu_client_config.json | 25 + .../google-cloud-tpu/test/gapic_tpu_v2.ts | 3558 +++ .../test/gapic_tpu_v2alpha1.ts | 2572 ++- 132 files changed, 36941 insertions(+), 26733 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/README.md delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/package.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/README.md delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/package.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-tpu/v2alpha1/webpack.config.js rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/protos/google/cloud/tpu/v2/cloud_tpu.proto (100%) create mode 100644 packages/google-cloud-tpu/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.create_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.delete_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.generate_service_identity.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.get_accelerator_type.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.get_guest_attributes.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.get_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.get_runtime_version.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.list_accelerator_types.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.list_nodes.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.list_runtime_versions.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.start_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.stop_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/samples/generated/v2/tpu.update_node.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2alpha1 => packages/google-cloud-tpu}/samples/generated/v2alpha1/tpu.create_queued_resource.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2alpha1 => packages/google-cloud-tpu}/samples/generated/v2alpha1/tpu.delete_queued_resource.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2alpha1 => packages/google-cloud-tpu}/samples/generated/v2alpha1/tpu.get_queued_resource.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2alpha1 => packages/google-cloud-tpu}/samples/generated/v2alpha1/tpu.list_queued_resources.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2alpha1 => packages/google-cloud-tpu}/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/src/v2/gapic_metadata.json (100%) rename {owl-bot-staging/google-cloud-tpu/v1/src/v1 => packages/google-cloud-tpu/src/v2}/index.ts (100%) create mode 100644 packages/google-cloud-tpu/src/v2/tpu_client.ts rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/src/v2/tpu_client_config.json (100%) rename {owl-bot-staging/google-cloud-tpu/v2 => packages/google-cloud-tpu}/src/v2/tpu_proto_list.json (100%) create mode 100644 packages/google-cloud-tpu/test/gapic_tpu_v2.ts diff --git a/owl-bot-staging/google-cloud-tpu/v1/.eslintignore b/owl-bot-staging/google-cloud-tpu/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/.gitignore b/owl-bot-staging/google-cloud-tpu/v1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js deleted file mode 100644 index 5b3c57ae725..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/tpu', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/README.md b/owl-bot-staging/google-cloud-tpu/v1/README.md deleted file mode 100644 index b04db0dc280..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/package.json b/owl-bot-staging/google-cloud-tpu/v1/package.json deleted file mode 100644 index 911441f5cee..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/tpu", - "version": "0.1.0", - "description": "Tpu client for Node.js", - "repository": "googleapis/nodejs-tpu", - "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 tpu", - "tpu", - "tpu" - ], - "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.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto b/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto deleted file mode 100644 index c2acf92f439..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/protos/google/cloud/tpu/v1/cloud_tpu.proto +++ /dev/null @@ -1,617 +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.cloud.tpu.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v1;tpu"; -option java_multiple_files = true; -option java_outer_classname = "CloudTpuProto"; -option java_package = "com.google.cloud.tpu.v1"; - -// Manages TPU nodes and other resources -// -// TPU API v1 -service Tpu { - option (google.api.default_host) = "tpu.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists nodes. - rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/nodes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a node. - rpc GetNode(GetNodeRequest) returns (Node) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/nodes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a node. - rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/nodes" - body: "node" - }; - option (google.api.method_signature) = "parent,node,node_id"; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a node. - rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/nodes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Reimages a node's OS. - rpc ReimageNode(ReimageNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/nodes/*}:reimage" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Stops a node, this operation is only available with single TPU nodes. - rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/nodes/*}:stop" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Starts a node. - rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/nodes/*}:start" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // List TensorFlow versions supported by this API. - rpc ListTensorFlowVersions(ListTensorFlowVersionsRequest) returns (ListTensorFlowVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/tensorflowVersions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets TensorFlow Version. - rpc GetTensorFlowVersion(GetTensorFlowVersionRequest) returns (TensorFlowVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/tensorflowVersions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists accelerator types supported by this API. - rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/acceleratorTypes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets AcceleratorType. - rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/acceleratorTypes/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Sets the scheduling options for this node. -message SchedulingConfig { - // Defines whether the node is preemptible. - bool preemptible = 1; - - // Whether the node is created under a reservation. - bool reserved = 2; -} - -// A network endpoint over which a TPU worker can be reached. -message NetworkEndpoint { - // The IP address of this network endpoint. - string ip_address = 1; - - // The port of this network endpoint. - int32 port = 2; -} - -// A TPU instance. -message Node { - option (google.api.resource) = { - type: "tpu.googleapis.com/Node" - pattern: "projects/{project}/locations/{location}/nodes/{node}" - }; - - // Represents the different states of a TPU node during its lifecycle. - enum State { - // TPU node state is not known/set. - STATE_UNSPECIFIED = 0; - - // TPU node is being created. - CREATING = 1; - - // TPU node has been created. - READY = 2; - - // TPU node is restarting. - RESTARTING = 3; - - // TPU node is undergoing reimaging. - REIMAGING = 4; - - // TPU node is being deleted. - DELETING = 5; - - // TPU node is being repaired and may be unusable. Details can be - // found in the `help_description` field. - REPAIRING = 6; - - // TPU node is stopped. - STOPPED = 8; - - // TPU node is currently stopping. - STOPPING = 9; - - // TPU node is currently starting. - STARTING = 10; - - // TPU node has been preempted. Only applies to Preemptible TPU Nodes. - PREEMPTED = 11; - - // TPU node has been terminated due to maintenance or has reached the end of - // its life cycle (for preemptible nodes). - TERMINATED = 12; - - // TPU node is currently hiding. - HIDING = 13; - - // TPU node has been hidden. - HIDDEN = 14; - - // TPU node is currently unhiding. - UNHIDING = 15; - } - - // Health defines the status of a TPU node as reported by - // Health Monitor. - enum Health { - // Health status is unknown: not initialized or failed to retrieve. - HEALTH_UNSPECIFIED = 0; - - // The resource is healthy. - HEALTHY = 1; - - // The resource is unhealthy. - DEPRECATED_UNHEALTHY = 2; - - // The resource is unresponsive. - TIMEOUT = 3; - - // The in-guest ML stack is unhealthy. - UNHEALTHY_TENSORFLOW = 4; - - // The node is under maintenance/priority boost caused rescheduling and - // will resume running once rescheduled. - UNHEALTHY_MAINTENANCE = 5; - } - - // TPU API Version. - enum ApiVersion { - // API version is unknown. - API_VERSION_UNSPECIFIED = 0; - - // TPU API V1Alpha1 version. - V1_ALPHA1 = 1; - - // TPU API V1 version. - V1 = 2; - - // TPU API V2Alpha1 version. - V2_ALPHA1 = 3; - } - - // Output only. Immutable. The name of the TPU - string name = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // The user-supplied description of the TPU. Maximum of 512 characters. - string description = 3; - - // Required. The type of hardware accelerators associated with this node. - string accelerator_type = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. DEPRECATED! Use network_endpoints instead. - // The network address for the TPU Node as visible to Compute Engine - // instances. - string ip_address = 8 [deprecated = true]; - - // Output only. DEPRECATED! Use network_endpoints instead. - // The network port for the TPU Node as visible to Compute Engine instances. - string port = 14 [deprecated = true]; - - // Output only. The current state for the TPU Node. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this field is populated, it contains a description of why the TPU Node - // is unhealthy. - string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The version of Tensorflow running in the Node. - string tensorflow_version = 11 [(google.api.field_behavior) = REQUIRED]; - - // The name of a network they wish to peer the TPU node to. It must be a - // preexisting Compute Engine network inside of the project on which this API - // has been activated. If none is provided, "default" will be used. - string network = 12; - - // The CIDR block that the TPU node will use when selecting an IP address. - // This CIDR block must be a /29 block; the Compute Engine networks API - // forbids a smaller block, and using a larger block would be wasteful (a - // node can only consume one IP address). Errors will occur if the CIDR block - // has already been used for a currently existing TPU node, the CIDR block - // conflicts with any subnetworks in the user's provided network, or the - // provided network is peered with another network that is using that CIDR - // block. - string cidr_block = 13; - - // Output only. The service account used to run the tensor flow services within the node. - // To share resources, including Google Cloud Storage data, with the - // Tensorflow job running in the Node, this account must have permissions to - // that data. - string service_account = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the node was created. - google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The scheduling options for this node. - SchedulingConfig scheduling_config = 17; - - // Output only. The network endpoints where TPU workers can be accessed and - // sent work. It is recommended that Tensorflow clients of the node reach out - // to the 0th entry in this map first. - repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The health status of the TPU node. - Health health = 22; - - // Resource labels to represent user-provided metadata. - map labels = 24; - - // Whether the VPC peering for the node is set up through Service Networking - // API. The VPC Peering should be set up before provisioning the node. - // If this field is set, cidr_block field should not be specified. If the - // network, that you want to peer the TPU Node to, is Shared VPC networks, - // the node must be created with this this field enabled. - bool use_service_networking = 27; - - // Output only. The API version that created this Node. - ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Symptoms that have occurred to the TPU Node. - repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [ListNodes][google.cloud.tpu.v1.Tpu.ListNodes]. -message ListNodesRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/Node" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response for [ListNodes][google.cloud.tpu.v1.Tpu.ListNodes]. -message ListNodesResponse { - // The listed nodes. - repeated Node nodes = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetNode][google.cloud.tpu.v1.Tpu.GetNode]. -message GetNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; -} - -// Request for [CreateNode][google.cloud.tpu.v1.Tpu.CreateNode]. -message CreateNodeRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/Node" - } - ]; - - // The unqualified resource name. - string node_id = 2; - - // Required. The node. - Node node = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [DeleteNode][google.cloud.tpu.v1.Tpu.DeleteNode]. -message DeleteNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; -} - -// Request for [ReimageNode][google.cloud.tpu.v1.Tpu.ReimageNode]. -message ReimageNodeRequest { - // The resource name. - string name = 1; - - // The version for reimage to create. - string tensorflow_version = 2; -} - -// Request for [StopNode][google.cloud.tpu.v1.Tpu.StopNode]. -message StopNodeRequest { - // The resource name. - string name = 1; -} - -// Request for [StartNode][google.cloud.tpu.v1.Tpu.StartNode]. -message StartNodeRequest { - // The resource name. - string name = 1; -} - -// A tensorflow version that a Node can be configured with. -message TensorFlowVersion { - option (google.api.resource) = { - type: "tpu.googleapis.com/TensorFlowVersion" - pattern: "projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}" - }; - - // The resource name. - string name = 1; - - // the tensorflow version. - string version = 2; -} - -// Request for [GetTensorFlowVersion][google.cloud.tpu.v1.Tpu.GetTensorFlowVersion]. -message GetTensorFlowVersionRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/TensorFlowVersion" - } - ]; -} - -// Request for [ListTensorFlowVersions][google.cloud.tpu.v1.Tpu.ListTensorFlowVersions]. -message ListTensorFlowVersionsRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/TensorFlowVersion" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; - - // List filter. - string filter = 5; - - // Sort results. - string order_by = 6; -} - -// Response for [ListTensorFlowVersions][google.cloud.tpu.v1.Tpu.ListTensorFlowVersions]. -message ListTensorFlowVersionsResponse { - // The listed nodes. - repeated TensorFlowVersion tensorflow_versions = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A accelerator type that a Node can be configured with. -message AcceleratorType { - option (google.api.resource) = { - type: "tpu.googleapis.com/AcceleratorType" - pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" - }; - - // The resource name. - string name = 1; - - // the accelerator type. - string type = 2; -} - -// Request for [GetAcceleratorType][google.cloud.tpu.v1.Tpu.GetAcceleratorType]. -message GetAcceleratorTypeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/AcceleratorType" - } - ]; -} - -// Request for [ListAcceleratorTypes][google.cloud.tpu.v1.Tpu.ListAcceleratorTypes]. -message ListAcceleratorTypesRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/AcceleratorType" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; - - // List filter. - string filter = 5; - - // Sort results. - string order_by = 6; -} - -// Response for [ListAcceleratorTypes][google.cloud.tpu.v1.Tpu.ListAcceleratorTypes]. -message ListAcceleratorTypesResponse { - // The listed nodes. - repeated AcceleratorType accelerator_types = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Target of the operation - for example - // projects/project-1/connectivityTests/test-1 - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Specifies if cancellation was requested for the operation. - bool cancel_requested = 6; - - // API version. - string api_version = 7; -} - -// A Symptom instance. -message Symptom { - // SymptomType represents the different types of Symptoms that a TPU can be - // at. - enum SymptomType { - // Unspecified symptom. - SYMPTOM_TYPE_UNSPECIFIED = 0; - - // TPU VM memory is low. - LOW_MEMORY = 1; - - // TPU runtime is out of memory. - OUT_OF_MEMORY = 2; - - // TPU runtime execution has timed out. - EXECUTE_TIMED_OUT = 3; - - // TPU runtime fails to construct a mesh that recognizes each TPU device's - // neighbors. - MESH_BUILD_FAIL = 4; - - // TPU HBM is out of memory. - HBM_OUT_OF_MEMORY = 5; - - // Abusive behaviors have been identified on the current project. - PROJECT_ABUSE = 6; - } - - // Timestamp when the Symptom is created. - google.protobuf.Timestamp create_time = 1; - - // Type of the Symptom. - SymptomType symptom_type = 2; - - // Detailed information of the current Symptom. - string details = 3; - - // A string used to uniquely distinguish a worker within a TPU node. - string worker_id = 4; -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json deleted file mode 100644 index 749983cd917..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/snippet_metadata.google.cloud.tpu.v1.json +++ /dev/null @@ -1,507 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-tpu", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.tpu.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "tpu_v1_generated_Tpu_ListNodes_async", - "title": "Tpu listNodes Sample", - "origin": "API_DEFINITION", - "description": " Lists nodes.", - "canonical": true, - "file": "tpu.list_nodes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v1.Tpu.ListNodes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.ListNodesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v1.Tpu.ListNodes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_GetNode_async", - "title": "Tpu getNode Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a node.", - "canonical": true, - "file": "tpu.get_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v1.Tpu.GetNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.Node", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v1.Tpu.GetNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_CreateNode_async", - "title": "Tpu createNode Sample", - "origin": "API_DEFINITION", - "description": " Creates a node.", - "canonical": true, - "file": "tpu.create_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v1.Tpu.CreateNode", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "node_id", - "type": "TYPE_STRING" - }, - { - "name": "node", - "type": ".google.cloud.tpu.v1.Node" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v1.Tpu.CreateNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_DeleteNode_async", - "title": "Tpu deleteNode Sample", - "origin": "API_DEFINITION", - "description": " Deletes a node.", - "canonical": true, - "file": "tpu.delete_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v1.Tpu.DeleteNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v1.Tpu.DeleteNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_ReimageNode_async", - "title": "Tpu reimageNode Sample", - "origin": "API_DEFINITION", - "description": " Reimages a node's OS.", - "canonical": true, - "file": "tpu.reimage_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReimageNode", - "fullName": "google.cloud.tpu.v1.Tpu.ReimageNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "tensorflow_version", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "ReimageNode", - "fullName": "google.cloud.tpu.v1.Tpu.ReimageNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_StopNode_async", - "title": "Tpu stopNode Sample", - "origin": "API_DEFINITION", - "description": " Stops a node, this operation is only available with single TPU nodes.", - "canonical": true, - "file": "tpu.stop_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v1.Tpu.StopNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v1.Tpu.StopNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_StartNode_async", - "title": "Tpu startNode Sample", - "origin": "API_DEFINITION", - "description": " Starts a node.", - "canonical": true, - "file": "tpu.start_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v1.Tpu.StartNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v1.Tpu.StartNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_ListTensorFlowVersions_async", - "title": "Tpu listTensorFlowVersions Sample", - "origin": "API_DEFINITION", - "description": " List TensorFlow versions supported by this API.", - "canonical": true, - "file": "tpu.list_tensor_flow_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTensorFlowVersions", - "fullName": "google.cloud.tpu.v1.Tpu.ListTensorFlowVersions", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.ListTensorFlowVersionsResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "ListTensorFlowVersions", - "fullName": "google.cloud.tpu.v1.Tpu.ListTensorFlowVersions", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_GetTensorFlowVersion_async", - "title": "Tpu getTensorFlowVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets TensorFlow Version.", - "canonical": true, - "file": "tpu.get_tensor_flow_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTensorFlowVersion", - "fullName": "google.cloud.tpu.v1.Tpu.GetTensorFlowVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.TensorFlowVersion", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "GetTensorFlowVersion", - "fullName": "google.cloud.tpu.v1.Tpu.GetTensorFlowVersion", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_ListAcceleratorTypes_async", - "title": "Tpu listAcceleratorTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists accelerator types supported by this API.", - "canonical": true, - "file": "tpu.list_accelerator_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v1.Tpu.ListAcceleratorTypes", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.ListAcceleratorTypesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v1.Tpu.ListAcceleratorTypes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v1_generated_Tpu_GetAcceleratorType_async", - "title": "Tpu getAcceleratorType Sample", - "origin": "API_DEFINITION", - "description": " Gets AcceleratorType.", - "canonical": true, - "file": "tpu.get_accelerator_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v1.Tpu.GetAcceleratorType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v1.AcceleratorType", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v1.TpuClient" - }, - "method": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v1.Tpu.GetAcceleratorType", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v1.Tpu" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js deleted file mode 100644 index 35fcf2bec3a..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.create_node.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, node) { - // [START tpu_v1_generated_Tpu_CreateNode_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 name. - */ - // const parent = 'abc123' - /** - * The unqualified resource name. - */ - // const nodeId = 'abc123' - /** - * Required. The node. - */ - // const node = {} - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callCreateNode() { - // Construct request - const request = { - parent, - node, - }; - - // Run request - const [operation] = await tpuClient.createNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateNode(); - // [END tpu_v1_generated_Tpu_CreateNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js deleted file mode 100644 index ad364cdbb8a..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.delete_node.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v1_generated_Tpu_DeleteNode_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callDeleteNode() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await tpuClient.deleteNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteNode(); - // [END tpu_v1_generated_Tpu_DeleteNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js deleted file mode 100644 index b2e8afbdd48..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_accelerator_type.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v1_generated_Tpu_GetAcceleratorType_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetAcceleratorType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getAcceleratorType(request); - console.log(response); - } - - callGetAcceleratorType(); - // [END tpu_v1_generated_Tpu_GetAcceleratorType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js deleted file mode 100644 index 70b0c8ff589..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_node.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v1_generated_Tpu_GetNode_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetNode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getNode(request); - console.log(response); - } - - callGetNode(); - // [END tpu_v1_generated_Tpu_GetNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js deleted file mode 100644 index 479389099cd..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.get_tensor_flow_version.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v1_generated_Tpu_GetTensorFlowVersion_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetTensorFlowVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getTensorFlowVersion(request); - console.log(response); - } - - callGetTensorFlowVersion(); - // [END tpu_v1_generated_Tpu_GetTensorFlowVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js deleted file mode 100644 index 9458a1aef12..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_accelerator_types.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v1_generated_Tpu_ListAcceleratorTypes_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - /** - * Sort results. - */ - // const orderBy = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListAcceleratorTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listAcceleratorTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAcceleratorTypes(); - // [END tpu_v1_generated_Tpu_ListAcceleratorTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js deleted file mode 100644 index c7165073b90..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_nodes.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v1_generated_Tpu_ListNodes_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListNodes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listNodesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNodes(); - // [END tpu_v1_generated_Tpu_ListNodes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js deleted file mode 100644 index 6884855a885..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.list_tensor_flow_versions.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v1_generated_Tpu_ListTensorFlowVersions_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - /** - * Sort results. - */ - // const orderBy = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListTensorFlowVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listTensorFlowVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTensorFlowVersions(); - // [END tpu_v1_generated_Tpu_ListTensorFlowVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js deleted file mode 100644 index 5963a05144d..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.reimage_node.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START tpu_v1_generated_Tpu_ReimageNode_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 resource name. - */ - // const name = 'abc123' - /** - * The version for reimage to create. - */ - // const tensorflowVersion = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callReimageNode() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await tpuClient.reimageNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReimageNode(); - // [END tpu_v1_generated_Tpu_ReimageNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js deleted file mode 100644 index 61d31d20b5a..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.start_node.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START tpu_v1_generated_Tpu_StartNode_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 resource name. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callStartNode() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await tpuClient.startNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStartNode(); - // [END tpu_v1_generated_Tpu_StartNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js b/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js deleted file mode 100644 index e3b7891529f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/samples/generated/v1/tpu.stop_node.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START tpu_v1_generated_Tpu_StopNode_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 resource name. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callStopNode() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await tpuClient.stopNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStopNode(); - // [END tpu_v1_generated_Tpu_StopNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/index.ts b/owl-bot-staging/google-cloud-tpu/v1/src/index.ts deleted file mode 100644 index 5dedc6879ab..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const TpuClient = v1.TpuClient; -type TpuClient = v1.TpuClient; -export {v1, TpuClient}; -export default {v1, TpuClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json deleted file mode 100644 index b15f377b942..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.tpu.v1", - "libraryPackage": "@google-cloud/tpu", - "services": { - "Tpu": { - "clients": { - "grpc": { - "libraryClient": "TpuClient", - "rpcs": { - "GetNode": { - "methods": [ - "getNode" - ] - }, - "GetTensorFlowVersion": { - "methods": [ - "getTensorFlowVersion" - ] - }, - "GetAcceleratorType": { - "methods": [ - "getAcceleratorType" - ] - }, - "CreateNode": { - "methods": [ - "createNode" - ] - }, - "DeleteNode": { - "methods": [ - "deleteNode" - ] - }, - "ReimageNode": { - "methods": [ - "reimageNode" - ] - }, - "StopNode": { - "methods": [ - "stopNode" - ] - }, - "StartNode": { - "methods": [ - "startNode" - ] - }, - "ListNodes": { - "methods": [ - "listNodes", - "listNodesStream", - "listNodesAsync" - ] - }, - "ListTensorFlowVersions": { - "methods": [ - "listTensorFlowVersions", - "listTensorFlowVersionsStream", - "listTensorFlowVersionsAsync" - ] - }, - "ListAcceleratorTypes": { - "methods": [ - "listAcceleratorTypes", - "listAcceleratorTypesStream", - "listAcceleratorTypesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TpuClient", - "rpcs": { - "GetNode": { - "methods": [ - "getNode" - ] - }, - "GetTensorFlowVersion": { - "methods": [ - "getTensorFlowVersion" - ] - }, - "GetAcceleratorType": { - "methods": [ - "getAcceleratorType" - ] - }, - "CreateNode": { - "methods": [ - "createNode" - ] - }, - "DeleteNode": { - "methods": [ - "deleteNode" - ] - }, - "ReimageNode": { - "methods": [ - "reimageNode" - ] - }, - "StopNode": { - "methods": [ - "stopNode" - ] - }, - "StartNode": { - "methods": [ - "startNode" - ] - }, - "ListNodes": { - "methods": [ - "listNodes", - "listNodesStream", - "listNodesAsync" - ] - }, - "ListTensorFlowVersions": { - "methods": [ - "listTensorFlowVersions", - "listTensorFlowVersionsStream", - "listTensorFlowVersionsAsync" - ] - }, - "ListAcceleratorTypes": { - "methods": [ - "listAcceleratorTypes", - "listAcceleratorTypesStream", - "listAcceleratorTypesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts deleted file mode 100644 index 7e15e54301f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client.ts +++ /dev/null @@ -1,2094 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/v1/tpu_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './tpu_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages TPU nodes and other resources - * - * TPU API v1 - * @class - * @memberof v1 - */ -export class TpuClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - tpuStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TpuClient. - * - * @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 TpuClient({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 TpuClient; - 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.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 = { - acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - nodePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/nodes/{node}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - tensorFlowVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}' - ), - }; - - // 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 = { - listNodes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), - listTensorFlowVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tensorflowVersions'), - listAcceleratorTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes') - }; - - 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.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; - const createNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; - const deleteNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; - const deleteNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; - const reimageNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; - const reimageNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; - const stopNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; - const stopNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; - const startNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.Node') as gax.protobuf.Type; - const startNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createNodeResponse.decode.bind(createNodeResponse), - createNodeMetadata.decode.bind(createNodeMetadata)), - deleteNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteNodeResponse.decode.bind(deleteNodeResponse), - deleteNodeMetadata.decode.bind(deleteNodeMetadata)), - reimageNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - reimageNodeResponse.decode.bind(reimageNodeResponse), - reimageNodeMetadata.decode.bind(reimageNodeMetadata)), - stopNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopNodeResponse.decode.bind(stopNodeResponse), - stopNodeMetadata.decode.bind(stopNodeMetadata)), - startNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startNodeResponse.decode.bind(startNodeResponse), - startNodeMetadata.decode.bind(startNodeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.tpu.v1.Tpu', 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.tpuStub) { - return this.tpuStub; - } - - // Put together the "service stub" for - // google.cloud.tpu.v1.Tpu. - this.tpuStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v1.Tpu') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.tpu.v1.Tpu, - 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 tpuStubMethods = - ['listNodes', 'getNode', 'createNode', 'deleteNode', 'reimageNode', 'stopNode', 'startNode', 'listTensorFlowVersions', 'getTensorFlowVersion', 'listAcceleratorTypes', 'getAcceleratorType']; - for (const methodName of tpuStubMethods) { - const callPromise = this.tpuStub.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.tpuStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'tpu.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 'tpu.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 the details of a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [Node]{@link google.cloud.tpu.v1.Node}. - * 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/tpu.get_node.js - * region_tag:tpu_v1_generated_Tpu_GetNode_async - */ - getNode( - request?: protos.google.cloud.tpu.v1.IGetNodeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|undefined, {}|undefined - ]>; - getNode( - request: protos.google.cloud.tpu.v1.IGetNodeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request: protos.google.cloud.tpu.v1.IGetNodeRequest, - callback: Callback< - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request?: protos.google.cloud.tpu.v1.IGetNodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v1.INode, - protos.google.cloud.tpu.v1.IGetNodeRequest|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.getNode(request, options, callback); - } -/** - * Gets TensorFlow Version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. - * 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/tpu.get_tensor_flow_version.js - * region_tag:tpu_v1_generated_Tpu_GetTensorFlowVersion_async - */ - getTensorFlowVersion( - request?: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|undefined, {}|undefined - ]>; - getTensorFlowVersion( - request: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, - {}|null|undefined>): void; - getTensorFlowVersion( - request: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, - callback: Callback< - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, - {}|null|undefined>): void; - getTensorFlowVersion( - request?: protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v1.ITensorFlowVersion, - protos.google.cloud.tpu.v1.IGetTensorFlowVersionRequest|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.getTensorFlowVersion(request, options, callback); - } -/** - * Gets AcceleratorType. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. - * 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/tpu.get_accelerator_type.js - * region_tag:tpu_v1_generated_Tpu_GetAcceleratorType_async - */ - getAcceleratorType( - request?: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|undefined, {}|undefined - ]>; - getAcceleratorType( - request: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, - callback: Callback< - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request?: protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v1.IAcceleratorType, - protos.google.cloud.tpu.v1.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); - } - -/** - * Creates a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {string} request.nodeId - * The unqualified resource name. - * @param {google.cloud.tpu.v1.Node} request.node - * Required. The node. - * @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/tpu.create_node.js - * region_tag:tpu_v1_generated_Tpu_CreateNode_async - */ - createNode( - request?: protos.google.cloud.tpu.v1.ICreateNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createNode( - request: protos.google.cloud.tpu.v1.ICreateNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request: protos.google.cloud.tpu.v1.ICreateNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request?: protos.google.cloud.tpu.v1.ICreateNodeRequest, - 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.createNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createNode()`. - * @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/tpu.create_node.js - * region_tag:tpu_v1_generated_Tpu_CreateNode_async - */ - async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/tpu.delete_node.js - * region_tag:tpu_v1_generated_Tpu_DeleteNode_async - */ - deleteNode( - request?: protos.google.cloud.tpu.v1.IDeleteNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteNode( - request: protos.google.cloud.tpu.v1.IDeleteNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request: protos.google.cloud.tpu.v1.IDeleteNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request?: protos.google.cloud.tpu.v1.IDeleteNodeRequest, - 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.deleteNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteNode()`. - * @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/tpu.delete_node.js - * region_tag:tpu_v1_generated_Tpu_DeleteNode_async - */ - async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Reimages a node's OS. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name. - * @param {string} request.tensorflowVersion - * The version for reimage 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/tpu.reimage_node.js - * region_tag:tpu_v1_generated_Tpu_ReimageNode_async - */ - reimageNode( - request?: protos.google.cloud.tpu.v1.IReimageNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - reimageNode( - request: protos.google.cloud.tpu.v1.IReimageNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reimageNode( - request: protos.google.cloud.tpu.v1.IReimageNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - reimageNode( - request?: protos.google.cloud.tpu.v1.IReimageNodeRequest, - 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.reimageNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `reimageNode()`. - * @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/tpu.reimage_node.js - * region_tag:tpu_v1_generated_Tpu_ReimageNode_async - */ - async checkReimageNodeProgress(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.reimageNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops a node, this operation is only available with single TPU nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name. - * @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/tpu.stop_node.js - * region_tag:tpu_v1_generated_Tpu_StopNode_async - */ - stopNode( - request?: protos.google.cloud.tpu.v1.IStopNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopNode( - request: protos.google.cloud.tpu.v1.IStopNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request: protos.google.cloud.tpu.v1.IStopNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request?: protos.google.cloud.tpu.v1.IStopNodeRequest, - 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.stopNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopNode()`. - * @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/tpu.stop_node.js - * region_tag:tpu_v1_generated_Tpu_StopNode_async - */ - async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name. - * @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/tpu.start_node.js - * region_tag:tpu_v1_generated_Tpu_StartNode_async - */ - startNode( - request?: protos.google.cloud.tpu.v1.IStartNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startNode( - request: protos.google.cloud.tpu.v1.IStartNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request: protos.google.cloud.tpu.v1.IStartNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request?: protos.google.cloud.tpu.v1.IStartNodeRequest, - 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.startNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startNode()`. - * @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/tpu.start_node.js - * region_tag:tpu_v1_generated_Tpu_StartNode_async - */ - async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v1.Node}. - * 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 `listNodesAsync()` - * 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. - */ - listNodes( - request?: protos.google.cloud.tpu.v1.IListNodesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.INode[], - protos.google.cloud.tpu.v1.IListNodesRequest|null, - protos.google.cloud.tpu.v1.IListNodesResponse - ]>; - listNodes( - request: protos.google.cloud.tpu.v1.IListNodesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListNodesRequest, - protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v1.INode>): void; - listNodes( - request: protos.google.cloud.tpu.v1.IListNodesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListNodesRequest, - protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v1.INode>): void; - listNodes( - request?: protos.google.cloud.tpu.v1.IListNodesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v1.IListNodesRequest, - protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v1.INode>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v1.IListNodesRequest, - protos.google.cloud.tpu.v1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v1.INode>): - Promise<[ - protos.google.cloud.tpu.v1.INode[], - protos.google.cloud.tpu.v1.IListNodesRequest|null, - protos.google.cloud.tpu.v1.IListNodesResponse - ]>|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.listNodes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v1.Node} 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 `listNodesAsync()` - * 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. - */ - listNodesStream( - request?: protos.google.cloud.tpu.v1.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNodes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 - * [Node]{@link google.cloud.tpu.v1.Node}. 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/tpu.list_nodes.js - * region_tag:tpu_v1_generated_Tpu_ListNodes_async - */ - listNodesAsync( - request?: protos.google.cloud.tpu.v1.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.asyncIterate( - this.innerApiCalls['listNodes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List TensorFlow versions supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. - * 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 `listTensorFlowVersionsAsync()` - * 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. - */ - listTensorFlowVersions( - request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.ITensorFlowVersion[], - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest|null, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse - ]>; - listTensorFlowVersions( - request: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, - protos.google.cloud.tpu.v1.ITensorFlowVersion>): void; - listTensorFlowVersions( - request: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, - protos.google.cloud.tpu.v1.ITensorFlowVersion>): void; - listTensorFlowVersions( - request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, - protos.google.cloud.tpu.v1.ITensorFlowVersion>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse|null|undefined, - protos.google.cloud.tpu.v1.ITensorFlowVersion>): - Promise<[ - protos.google.cloud.tpu.v1.ITensorFlowVersion[], - protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest|null, - protos.google.cloud.tpu.v1.IListTensorFlowVersionsResponse - ]>|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.listTensorFlowVersions(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion} 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 `listTensorFlowVersionsAsync()` - * 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. - */ - listTensorFlowVersionsStream( - request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - 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['listTensorFlowVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTensorFlowVersions.createStream( - this.innerApiCalls.listTensorFlowVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTensorFlowVersions`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [TensorFlowVersion]{@link google.cloud.tpu.v1.TensorFlowVersion}. 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/tpu.list_tensor_flow_versions.js - * region_tag:tpu_v1_generated_Tpu_ListTensorFlowVersions_async - */ - listTensorFlowVersionsAsync( - request?: protos.google.cloud.tpu.v1.IListTensorFlowVersionsRequest, - 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['listTensorFlowVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTensorFlowVersions.asyncIterate( - this.innerApiCalls['listTensorFlowVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists accelerator types supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. - * 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v1.IAcceleratorType[], - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse - ]>; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v1.IAcceleratorType>): void; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v1.IAcceleratorType>): void; - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v1.IAcceleratorType>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v1.IAcceleratorType>): - Promise<[ - protos.google.cloud.tpu.v1.IAcceleratorType[], - protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v1.IListAcceleratorTypesResponse - ]>|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.listAcceleratorTypes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType} 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypesStream( - request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.createStream( - this.innerApiCalls.listAcceleratorTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAcceleratorTypes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [AcceleratorType]{@link google.cloud.tpu.v1.AcceleratorType}. 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/tpu.list_accelerator_types.js - * region_tag:tpu_v1_generated_Tpu_ListAcceleratorTypes_async - */ - listAcceleratorTypesAsync( - request?: protos.google.cloud.tpu.v1.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.asyncIterate( - this.innerApiCalls['listAcceleratorTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * 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 [Location]{@link google.cloud.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 - * [Location]{@link google.cloud.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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} accelerator_type - * @returns {string} Resource name string. - */ - acceleratorTypePath(project:string,location:string,acceleratorType:string) { - return this.pathTemplates.acceleratorTypePathTemplate.render({ - project: project, - location: location, - accelerator_type: acceleratorType, - }); - } - - /** - * Parse the project from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; - } - - /** - * Parse the location from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; - } - - /** - * Parse the accelerator_type from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the accelerator_type. - */ - matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; - } - - /** - * 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 node resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} node - * @returns {string} Resource name string. - */ - nodePath(project:string,location:string,node:string) { - return this.pathTemplates.nodePathTemplate.render({ - project: project, - location: location, - node: node, - }); - } - - /** - * Parse the project from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).project; - } - - /** - * Parse the location from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).location; - } - - /** - * Parse the node from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the node. - */ - matchNodeFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).node; - } - - /** - * 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 tensorFlowVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} tensor_flow_version - * @returns {string} Resource name string. - */ - tensorFlowVersionPath(project:string,location:string,tensorFlowVersion:string) { - return this.pathTemplates.tensorFlowVersionPathTemplate.render({ - project: project, - location: location, - tensor_flow_version: tensorFlowVersion, - }); - } - - /** - * Parse the project from TensorFlowVersion resource. - * - * @param {string} tensorFlowVersionName - * A fully-qualified path representing TensorFlowVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTensorFlowVersionName(tensorFlowVersionName: string) { - return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).project; - } - - /** - * Parse the location from TensorFlowVersion resource. - * - * @param {string} tensorFlowVersionName - * A fully-qualified path representing TensorFlowVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTensorFlowVersionName(tensorFlowVersionName: string) { - return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).location; - } - - /** - * Parse the tensor_flow_version from TensorFlowVersion resource. - * - * @param {string} tensorFlowVersionName - * A fully-qualified path representing TensorFlowVersion resource. - * @returns {string} A string representing the tensor_flow_version. - */ - matchTensorFlowVersionFromTensorFlowVersionName(tensorFlowVersionName: string) { - return this.pathTemplates.tensorFlowVersionPathTemplate.match(tensorFlowVersionName).tensor_flow_version; - } - - /** - * 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.tpuStub && !this._terminated) { - return this.tpuStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json deleted file mode 100644 index 77bd991e873..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_client_config.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "interfaces": { - "google.cloud.tpu.v1.Tpu": { - "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": { - "ListNodes": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReimageNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTensorFlowVersions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTensorFlowVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListAcceleratorTypes": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAcceleratorType": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json b/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json deleted file mode 100644 index c79018be060..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/src/v1/tpu_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/tpu/v1/cloud_tpu.proto" -] diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 9cb87c17e68..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const tpu = require('@google-cloud/tpu'); - -function main() { - const tpuClient = new tpu.TpuClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 50ac473b84f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {TpuClient} from '@google-cloud/tpu'; - -// check that the client class type name can be used -function doStuffWithTpuClient(client: TpuClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const tpuClient = new TpuClient(); - doStuffWithTpuClient(tpuClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts b/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts deleted file mode 100644 index b3743be7903..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v1/test/gapic_tpu_v1.ts +++ /dev/null @@ -1,2672 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as tpuModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, 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('v1.TpuClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = tpuModule.v1.TpuClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = tpuModule.v1.TpuClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = tpuModule.v1.TpuClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new tpuModule.v1.TpuClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new tpuModule.v1.TpuClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - await client.initialize(); - assert(client.tpuStub); - }); - - it('has close method for the initialized client', done => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.tpuStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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('getNode', () => { - it('invokes getNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); - const [response] = await client.getNode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNode( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.INode|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with closed client', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNode(request), expectedError); - }); - }); - - describe('getTensorFlowVersion', () => { - it('invokes getTensorFlowVersion without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.TensorFlowVersion() - ); - client.innerApiCalls.getTensorFlowVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getTensorFlowVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTensorFlowVersion without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.TensorFlowVersion() - ); - client.innerApiCalls.getTensorFlowVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTensorFlowVersion( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.ITensorFlowVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTensorFlowVersion with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTensorFlowVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTensorFlowVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTensorFlowVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTensorFlowVersion with closed client', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetTensorFlowVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetTensorFlowVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getTensorFlowVersion(request), expectedError); - }); - }); - - describe('getAcceleratorType', () => { - it('invokes getAcceleratorType without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); - const [response] = await client.getAcceleratorType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v1.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAcceleratorType( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.IAcceleratorType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAcceleratorType(request), expectedError); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with closed client', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAcceleratorType(request), expectedError); - }); - }); - - describe('createNode', () => { - it('invokes createNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNode( - 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.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with call error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNode(request), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with LRO error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateNodeProgress without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkCreateNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateNodeProgress with error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkCreateNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteNode', () => { - it('invokes deleteNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNode( - 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.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with call error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNode(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with LRO error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteNodeProgress without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkDeleteNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteNodeProgress with error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkDeleteNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('reimageNode', () => { - it('invokes reimageNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ReimageNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reimageNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.reimageNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reimageNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ReimageNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.reimageNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reimageNode( - 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.reimageNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reimageNode with call error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ReimageNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reimageNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reimageNode(request), expectedError); - const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reimageNode with LRO error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ReimageNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ReimageNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reimageNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reimageNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reimageNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkReimageNodeProgress without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkReimageNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkReimageNodeProgress with error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkReimageNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopNode', () => { - it('invokes stopNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopNode( - 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.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with call error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopNode(request), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with LRO error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopNodeProgress without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkStopNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopNodeProgress with error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkStopNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startNode', () => { - it('invokes startNode without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.startNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startNode( - 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.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with call error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startNode(request), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with LRO error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartNodeProgress without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkStartNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartNodeProgress with error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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.checkStartNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listNodes', () => { - it('invokes listNodes without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.INode[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodesStream without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - ]; - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.Node) => { - 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.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodesStream with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v1.Node()), - ]; - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v1.INode[] = []; - const iterable = client.listNodesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v1.INode[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTensorFlowVersions', () => { - it('invokes listTensorFlowVersions without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - ]; - client.innerApiCalls.listTensorFlowVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listTensorFlowVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTensorFlowVersions without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - ]; - client.innerApiCalls.listTensorFlowVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTensorFlowVersions( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.ITensorFlowVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTensorFlowVersions with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTensorFlowVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTensorFlowVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTensorFlowVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTensorFlowVersionsStream without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - ]; - client.descriptors.page.listTensorFlowVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTensorFlowVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.TensorFlowVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.TensorFlowVersion) => { - 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.listTensorFlowVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTensorFlowVersions, request)); - assert( - (client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTensorFlowVersionsStream with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTensorFlowVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTensorFlowVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.TensorFlowVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.TensorFlowVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTensorFlowVersions, request)); - assert( - (client.descriptors.page.listTensorFlowVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTensorFlowVersions without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v1.TensorFlowVersion()), - ]; - client.descriptors.page.listTensorFlowVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v1.ITensorFlowVersion[] = []; - const iterable = client.listTensorFlowVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTensorFlowVersions with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListTensorFlowVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListTensorFlowVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listTensorFlowVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTensorFlowVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v1.ITensorFlowVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTensorFlowVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAcceleratorTypes', () => { - it('invokes listAcceleratorTypes without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listAcceleratorTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes without error using callback', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAcceleratorTypes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v1.IAcceleratorType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAcceleratorTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypesStream without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.AcceleratorType) => { - 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.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAcceleratorTypesStream with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v1.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v1.AcceleratorType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes without error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v1.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v1.IAcceleratorType[] = []; - const iterable = client.listAcceleratorTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes with error', async () => { - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAcceleratorTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v1.IAcceleratorType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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 tpuModule.v1.TpuClient({ - 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('acceleratorType', () => { - const fakePath = "/rendered/path/acceleratorType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - accelerator_type: "acceleratorTypeValue", - }; - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.acceleratorTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.acceleratorTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('acceleratorTypePath', () => { - const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAcceleratorTypeName', () => { - const result = client.matchProjectFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAcceleratorTypeName', () => { - const result = client.matchLocationFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAcceleratorTypeFromAcceleratorTypeName', () => { - const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "acceleratorTypeValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new tpuModule.v1.TpuClient({ - 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('node', () => { - const fakePath = "/rendered/path/node"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - node: "nodeValue", - }; - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodePath', () => { - const result = client.nodePath("projectValue", "locationValue", "nodeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeName', () => { - const result = client.matchProjectFromNodeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeName', () => { - const result = client.matchLocationFromNodeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeFromNodeName', () => { - const result = client.matchNodeFromNodeName(fakePath); - assert.strictEqual(result, "nodeValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new tpuModule.v1.TpuClient({ - 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('tensorFlowVersion', () => { - const fakePath = "/rendered/path/tensorFlowVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - tensor_flow_version: "tensorFlowVersionValue", - }; - const client = new tpuModule.v1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.tensorFlowVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.tensorFlowVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('tensorFlowVersionPath', () => { - const result = client.tensorFlowVersionPath("projectValue", "locationValue", "tensorFlowVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.tensorFlowVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTensorFlowVersionName', () => { - const result = client.matchProjectFromTensorFlowVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTensorFlowVersionName', () => { - const result = client.matchLocationFromTensorFlowVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTensorFlowVersionFromTensorFlowVersionName', () => { - const result = client.matchTensorFlowVersionFromTensorFlowVersionName(fakePath); - assert.strictEqual(result, "tensorFlowVersionValue"); - assert((client.pathTemplates.tensorFlowVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-tpu/v1/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v1/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v1/webpack.config.js deleted file mode 100644 index 8ee514d072f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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: 'Tpu', - filename: './tpu.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-cloud-tpu/v2/.eslintignore b/owl-bot-staging/google-cloud-tpu/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-tpu/v2/.gitignore b/owl-bot-staging/google-cloud-tpu/v2/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js deleted file mode 100644 index 5b3c57ae725..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/tpu', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-tpu/v2/README.md b/owl-bot-staging/google-cloud-tpu/v2/README.md deleted file mode 100644 index b04db0dc280..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v2/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/package.json b/owl-bot-staging/google-cloud-tpu/v2/package.json deleted file mode 100644 index 911441f5cee..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/tpu", - "version": "0.1.0", - "description": "Tpu client for Node.js", - "repository": "googleapis/nodejs-tpu", - "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 tpu", - "tpu", - "tpu" - ], - "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.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json b/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json deleted file mode 100644 index 177da816340..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json +++ /dev/null @@ -1,595 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-tpu", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.tpu.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "tpu_v2_generated_Tpu_ListNodes_async", - "title": "Tpu listNodes Sample", - "origin": "API_DEFINITION", - "description": " Lists nodes.", - "canonical": true, - "file": "tpu.list_nodes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.ListNodesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_GetNode_async", - "title": "Tpu getNode Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a node.", - "canonical": true, - "file": "tpu.get_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v2.Tpu.GetNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.Node", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v2.Tpu.GetNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_CreateNode_async", - "title": "Tpu createNode Sample", - "origin": "API_DEFINITION", - "description": " Creates a node.", - "canonical": true, - "file": "tpu.create_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "node_id", - "type": "TYPE_STRING" - }, - { - "name": "node", - "type": ".google.cloud.tpu.v2.Node" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_DeleteNode_async", - "title": "Tpu deleteNode Sample", - "origin": "API_DEFINITION", - "description": " Deletes a node.", - "canonical": true, - "file": "tpu.delete_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_StopNode_async", - "title": "Tpu stopNode Sample", - "origin": "API_DEFINITION", - "description": " Stops a node. This operation is only available with single TPU nodes.", - "canonical": true, - "file": "tpu.stop_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v2.Tpu.StopNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v2.Tpu.StopNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_StartNode_async", - "title": "Tpu startNode Sample", - "origin": "API_DEFINITION", - "description": " Starts a node.", - "canonical": true, - "file": "tpu.start_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v2.Tpu.StartNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v2.Tpu.StartNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_UpdateNode_async", - "title": "Tpu updateNode Sample", - "origin": "API_DEFINITION", - "description": " Updates the configurations of a node.", - "canonical": true, - "file": "tpu.update_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNode", - "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "node", - "type": ".google.cloud.tpu.v2.Node" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "UpdateNode", - "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_GenerateServiceIdentity_async", - "title": "Tpu generateServiceIdentity Sample", - "origin": "API_DEFINITION", - "description": " Generates the Cloud TPU service identity for the project.", - "canonical": true, - "file": "tpu.generate_service_identity.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateServiceIdentity", - "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.GenerateServiceIdentityResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "GenerateServiceIdentity", - "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_ListAcceleratorTypes_async", - "title": "Tpu listAcceleratorTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists accelerator types supported by this API.", - "canonical": true, - "file": "tpu.list_accelerator_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.ListAcceleratorTypesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_GetAcceleratorType_async", - "title": "Tpu getAcceleratorType Sample", - "origin": "API_DEFINITION", - "description": " Gets AcceleratorType.", - "canonical": true, - "file": "tpu.get_accelerator_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.AcceleratorType", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_ListRuntimeVersions_async", - "title": "Tpu listRuntimeVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists runtime versions supported by this API.", - "canonical": true, - "file": "tpu.list_runtime_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRuntimeVersions", - "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.ListRuntimeVersionsResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "ListRuntimeVersions", - "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_GetRuntimeVersion_async", - "title": "Tpu getRuntimeVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets a runtime version.", - "canonical": true, - "file": "tpu.get_runtime_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRuntimeVersion", - "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2.RuntimeVersion", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "GetRuntimeVersion", - "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2_generated_Tpu_GetGuestAttributes_async", - "title": "Tpu getGuestAttributes Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the guest attributes for the node.", - "canonical": true, - "file": "tpu.get_guest_attributes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGuestAttributes", - "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "query_path", - "type": "TYPE_STRING" - }, - { - "name": "worker_ids", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.tpu.v2.GetGuestAttributesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2.TpuClient" - }, - "method": { - "shortName": "GetGuestAttributes", - "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2.Tpu" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2/src/index.ts deleted file mode 100644 index b5f3bb8b00f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2 from './v2'; -const TpuClient = v2.TpuClient; -type TpuClient = v2.TpuClient; -export {v2, TpuClient}; -export default {v2, TpuClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts deleted file mode 100644 index 27c81814923..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/src/v2/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {TpuClient} from './tpu_client'; diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts deleted file mode 100644 index 59a9575625f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client.ts +++ /dev/null @@ -1,2249 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/tpu_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './tpu_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages TPU nodes and other resources - * - * TPU API v2 - * @class - * @memberof v2 - */ -export class TpuClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - tpuStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TpuClient. - * - * @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 TpuClient({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 TpuClient; - 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.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 = { - acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - nodePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/nodes/{node}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' - ), - }; - - // 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 = { - listNodes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), - listAcceleratorTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes'), - listRuntimeVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'runtimeVersions') - }; - - 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.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*}',},{get: '/v2/{name=projects/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=projects/*}/locations',},{get: '/v2alpha1/{name=projects/*}/locations',},{get: '/v2/{name=projects/*}/locations',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}/operations',},{get: '/v2alpha1/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; - const createNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; - const deleteNodeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; - const stopNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; - const stopNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; - const startNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; - const startNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; - const updateNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.Node') as gax.protobuf.Type; - const updateNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createNodeResponse.decode.bind(createNodeResponse), - createNodeMetadata.decode.bind(createNodeMetadata)), - deleteNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteNodeResponse.decode.bind(deleteNodeResponse), - deleteNodeMetadata.decode.bind(deleteNodeMetadata)), - stopNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopNodeResponse.decode.bind(stopNodeResponse), - stopNodeMetadata.decode.bind(stopNodeMetadata)), - startNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startNodeResponse.decode.bind(startNodeResponse), - startNodeMetadata.decode.bind(startNodeMetadata)), - updateNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateNodeResponse.decode.bind(updateNodeResponse), - updateNodeMetadata.decode.bind(updateNodeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.tpu.v2.Tpu', 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.tpuStub) { - return this.tpuStub; - } - - // Put together the "service stub" for - // google.cloud.tpu.v2.Tpu. - this.tpuStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v2.Tpu') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.tpu.v2.Tpu, - 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 tpuStubMethods = - ['listNodes', 'getNode', 'createNode', 'deleteNode', 'stopNode', 'startNode', 'updateNode', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes']; - for (const methodName of tpuStubMethods) { - const callPromise = this.tpuStub.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.tpuStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'tpu.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 'tpu.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 the details of a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [Node]{@link google.cloud.tpu.v2.Node}. - * 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/tpu.get_node.js - * region_tag:tpu_v2_generated_Tpu_GetNode_async - */ - getNode( - request?: protos.google.cloud.tpu.v2.IGetNodeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|undefined, {}|undefined - ]>; - getNode( - request: protos.google.cloud.tpu.v2.IGetNodeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request: protos.google.cloud.tpu.v2.IGetNodeRequest, - callback: Callback< - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request?: protos.google.cloud.tpu.v2.IGetNodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2.INode, - protos.google.cloud.tpu.v2.IGetNodeRequest|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.getNode(request, options, callback); - } -/** - * Generates the Cloud TPU service identity for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @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 [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2.GenerateServiceIdentityResponse}. - * 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/tpu.generate_service_identity.js - * region_tag:tpu_v2_generated_Tpu_GenerateServiceIdentity_async - */ - generateServiceIdentity( - request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|undefined, {}|undefined - ]>; - generateServiceIdentity( - request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): void; - generateServiceIdentity( - request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, - callback: Callback< - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): void; - generateServiceIdentity( - request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest|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.generateServiceIdentity(request, options, callback); - } -/** - * Gets AcceleratorType. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. - * 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/tpu.get_accelerator_type.js - * region_tag:tpu_v2_generated_Tpu_GetAcceleratorType_async - */ - getAcceleratorType( - request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|undefined, {}|undefined - ]>; - getAcceleratorType( - request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, - callback: Callback< - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2.IAcceleratorType, - protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); - } -/** - * Gets a runtime version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. - * 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/tpu.get_runtime_version.js - * region_tag:tpu_v2_generated_Tpu_GetRuntimeVersion_async - */ - getRuntimeVersion( - request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|undefined, {}|undefined - ]>; - getRuntimeVersion( - request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): void; - getRuntimeVersion( - request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, - callback: Callback< - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): void; - getRuntimeVersion( - request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2.IRuntimeVersion, - protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest|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.getRuntimeVersion(request, options, callback); - } -/** - * Retrieves the guest attributes for the node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @param {string} request.queryPath - * The guest attributes path to be queried. - * @param {string[]} request.workerIds - * The 0-based worker ID. If it is empty, all workers' GuestAttributes 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 [GetGuestAttributesResponse]{@link google.cloud.tpu.v2.GetGuestAttributesResponse}. - * 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/tpu.get_guest_attributes.js - * region_tag:tpu_v2_generated_Tpu_GetGuestAttributes_async - */ - getGuestAttributes( - request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|undefined, {}|undefined - ]>; - getGuestAttributes( - request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): void; - getGuestAttributes( - request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, - callback: Callback< - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): void; - getGuestAttributes( - request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2.IGetGuestAttributesRequest|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.getGuestAttributes(request, options, callback); - } - -/** - * Creates a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {string} request.nodeId - * The unqualified resource name. - * @param {google.cloud.tpu.v2.Node} request.node - * Required. The node. - * @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/tpu.create_node.js - * region_tag:tpu_v2_generated_Tpu_CreateNode_async - */ - createNode( - request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createNode( - request: protos.google.cloud.tpu.v2.ICreateNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request: protos.google.cloud.tpu.v2.ICreateNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, - 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.createNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createNode()`. - * @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/tpu.create_node.js - * region_tag:tpu_v2_generated_Tpu_CreateNode_async - */ - async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/tpu.delete_node.js - * region_tag:tpu_v2_generated_Tpu_DeleteNode_async - */ - deleteNode( - request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteNode( - request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, - 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.deleteNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteNode()`. - * @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/tpu.delete_node.js - * region_tag:tpu_v2_generated_Tpu_DeleteNode_async - */ - async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops a node. This operation is only available with single TPU nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/tpu.stop_node.js - * region_tag:tpu_v2_generated_Tpu_StopNode_async - */ - stopNode( - request?: protos.google.cloud.tpu.v2.IStopNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopNode( - request: protos.google.cloud.tpu.v2.IStopNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request: protos.google.cloud.tpu.v2.IStopNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request?: protos.google.cloud.tpu.v2.IStopNodeRequest, - 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.stopNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopNode()`. - * @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/tpu.stop_node.js - * region_tag:tpu_v2_generated_Tpu_StopNode_async - */ - async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/tpu.start_node.js - * region_tag:tpu_v2_generated_Tpu_StartNode_async - */ - startNode( - request?: protos.google.cloud.tpu.v2.IStartNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startNode( - request: protos.google.cloud.tpu.v2.IStartNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request: protos.google.cloud.tpu.v2.IStartNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request?: protos.google.cloud.tpu.v2.IStartNodeRequest, - 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.startNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startNode()`. - * @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/tpu.start_node.js - * region_tag:tpu_v2_generated_Tpu_StartNode_async - */ - async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the configurations of a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields from {@link Tpu.Node|Node} to update. - * Supported fields: [description, tags, labels, metadata, - * network_config.enable_external_ips]. - * @param {google.cloud.tpu.v2.Node} request.node - * Required. The node. Only fields specified in update_mask are updated. - * @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/tpu.update_node.js - * region_tag:tpu_v2_generated_Tpu_UpdateNode_async - */ - updateNode( - request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateNode( - request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNode( - request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNode( - request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, - 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({ - 'node.name': request.node!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateNode()`. - * @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/tpu.update_node.js - * region_tag:tpu_v2_generated_Tpu_UpdateNode_async - */ - async checkUpdateNodeProgress(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.updateNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v2.Node}. - * 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 `listNodesAsync()` - * 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. - */ - listNodes( - request?: protos.google.cloud.tpu.v2.IListNodesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.INode[], - protos.google.cloud.tpu.v2.IListNodesRequest|null, - protos.google.cloud.tpu.v2.IListNodesResponse - ]>; - listNodes( - request: protos.google.cloud.tpu.v2.IListNodesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListNodesRequest, - protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2.INode>): void; - listNodes( - request: protos.google.cloud.tpu.v2.IListNodesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListNodesRequest, - protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2.INode>): void; - listNodes( - request?: protos.google.cloud.tpu.v2.IListNodesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2.IListNodesRequest, - protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2.INode>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2.IListNodesRequest, - protos.google.cloud.tpu.v2.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2.INode>): - Promise<[ - protos.google.cloud.tpu.v2.INode[], - protos.google.cloud.tpu.v2.IListNodesRequest|null, - protos.google.cloud.tpu.v2.IListNodesResponse - ]>|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.listNodes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v2.Node} 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 `listNodesAsync()` - * 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. - */ - listNodesStream( - request?: protos.google.cloud.tpu.v2.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNodes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 - * [Node]{@link google.cloud.tpu.v2.Node}. 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/tpu.list_nodes.js - * region_tag:tpu_v2_generated_Tpu_ListNodes_async - */ - listNodesAsync( - request?: protos.google.cloud.tpu.v2.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.asyncIterate( - this.innerApiCalls['listNodes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists accelerator types supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. - * 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IAcceleratorType[], - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse - ]>; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2.IAcceleratorType>): void; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2.IAcceleratorType>): void; - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2.IAcceleratorType>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2.IAcceleratorType>): - Promise<[ - protos.google.cloud.tpu.v2.IAcceleratorType[], - protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse - ]>|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.listAcceleratorTypes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType} 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypesStream( - request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.createStream( - this.innerApiCalls.listAcceleratorTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAcceleratorTypes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. 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/tpu.list_accelerator_types.js - * region_tag:tpu_v2_generated_Tpu_ListAcceleratorTypes_async - */ - listAcceleratorTypesAsync( - request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.asyncIterate( - this.innerApiCalls['listAcceleratorTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists runtime versions supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. - * 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 `listRuntimeVersionsAsync()` - * 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. - */ - listRuntimeVersions( - request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2.IRuntimeVersion[], - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest|null, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse - ]>; - listRuntimeVersions( - request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2.IRuntimeVersion>): void; - listRuntimeVersions( - request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2.IRuntimeVersion>): void; - listRuntimeVersions( - request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2.IRuntimeVersion>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2.IRuntimeVersion>): - Promise<[ - protos.google.cloud.tpu.v2.IRuntimeVersion[], - protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest|null, - protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse - ]>|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.listRuntimeVersions(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion} 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 `listRuntimeVersionsAsync()` - * 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. - */ - listRuntimeVersionsStream( - request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - 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['listRuntimeVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRuntimeVersions.createStream( - this.innerApiCalls.listRuntimeVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRuntimeVersions`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. 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/tpu.list_runtime_versions.js - * region_tag:tpu_v2_generated_Tpu_ListRuntimeVersions_async - */ - listRuntimeVersionsAsync( - request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, - 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['listRuntimeVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRuntimeVersions.asyncIterate( - this.innerApiCalls['listRuntimeVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * 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 [Location]{@link google.cloud.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 - * [Location]{@link google.cloud.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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} accelerator_type - * @returns {string} Resource name string. - */ - acceleratorTypePath(project:string,location:string,acceleratorType:string) { - return this.pathTemplates.acceleratorTypePathTemplate.render({ - project: project, - location: location, - accelerator_type: acceleratorType, - }); - } - - /** - * Parse the project from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; - } - - /** - * Parse the location from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; - } - - /** - * Parse the accelerator_type from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the accelerator_type. - */ - matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; - } - - /** - * 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 node resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} node - * @returns {string} Resource name string. - */ - nodePath(project:string,location:string,node:string) { - return this.pathTemplates.nodePathTemplate.render({ - project: project, - location: location, - node: node, - }); - } - - /** - * Parse the project from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).project; - } - - /** - * Parse the location from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).location; - } - - /** - * Parse the node from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the node. - */ - matchNodeFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).node; - } - - /** - * 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 runtimeVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} runtime_version - * @returns {string} Resource name string. - */ - runtimeVersionPath(project:string,location:string,runtimeVersion:string) { - return this.pathTemplates.runtimeVersionPathTemplate.render({ - project: project, - location: location, - runtime_version: runtimeVersion, - }); - } - - /** - * Parse the project from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).project; - } - - /** - * Parse the location from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).location; - } - - /** - * Parse the runtime_version from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the runtime_version. - */ - matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).runtime_version; - } - - /** - * 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.tpuStub && !this._terminated) { - return this.tpuStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 9cb87c17e68..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const tpu = require('@google-cloud/tpu'); - -function main() { - const tpuClient = new tpu.TpuClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 50ac473b84f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {TpuClient} from '@google-cloud/tpu'; - -// check that the client class type name can be used -function doStuffWithTpuClient(client: TpuClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const tpuClient = new TpuClient(); - doStuffWithTpuClient(tpuClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts b/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts deleted file mode 100644 index 53c08b73811..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2/test/gapic_tpu_v2.ts +++ /dev/null @@ -1,2892 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as tpuModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, 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.TpuClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = tpuModule.v2.TpuClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = tpuModule.v2.TpuClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = tpuModule.v2.TpuClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new tpuModule.v2.TpuClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new tpuModule.v2.TpuClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - await client.initialize(); - assert(client.tpuStub); - }); - - it('has close method for the initialized client', done => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.tpuStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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('getNode', () => { - it('invokes getNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.Node() - ); - client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); - const [response] = await client.getNode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.Node() - ); - client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNode( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.INode|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with closed client', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNode(request), expectedError); - }); - }); - - describe('generateServiceIdentity', () => { - it('invokes generateServiceIdentity without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() - ); - client.innerApiCalls.generateServiceIdentity = stubSimpleCall(expectedResponse); - const [response] = await client.generateServiceIdentity(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() - ); - client.innerApiCalls.generateServiceIdentity = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateServiceIdentity( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateServiceIdentity = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateServiceIdentity(request), expectedError); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity with closed client', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateServiceIdentity(request), expectedError); - }); - }); - - describe('getAcceleratorType', () => { - it('invokes getAcceleratorType without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); - const [response] = await client.getAcceleratorType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAcceleratorType( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IAcceleratorType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAcceleratorType(request), expectedError); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with closed client', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAcceleratorType(request), expectedError); - }); - }); - - describe('getRuntimeVersion', () => { - it('invokes getRuntimeVersion without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.RuntimeVersion() - ); - client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getRuntimeVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.RuntimeVersion() - ); - client.innerApiCalls.getRuntimeVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRuntimeVersion( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IRuntimeVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRuntimeVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRuntimeVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion with closed client', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRuntimeVersion(request), expectedError); - }); - }); - - describe('getGuestAttributes', () => { - it('invokes getGuestAttributes without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() - ); - client.innerApiCalls.getGuestAttributes = stubSimpleCall(expectedResponse); - const [response] = await client.getGuestAttributes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() - ); - client.innerApiCalls.getGuestAttributes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGuestAttributes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IGetGuestAttributesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGuestAttributes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGuestAttributes(request), expectedError); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes with closed client', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGuestAttributes(request), expectedError); - }); - }); - - describe('createNode', () => { - it('invokes createNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNode( - 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.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with call error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNode(request), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with LRO error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateNodeProgress without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkCreateNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateNodeProgress with error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkCreateNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteNode', () => { - it('invokes deleteNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNode( - 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.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with call error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNode(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with LRO error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteNodeProgress without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkDeleteNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteNodeProgress with error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkDeleteNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopNode', () => { - it('invokes stopNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopNode( - 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.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with call error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopNode(request), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with LRO error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopNodeProgress without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkStopNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopNodeProgress with error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkStopNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startNode', () => { - it('invokes startNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.startNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startNode( - 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.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with call error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startNode(request), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with LRO error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartNodeProgress without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkStartNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartNodeProgress with error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkStartNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateNode', () => { - it('invokes updateNode without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNode( - 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.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode with call error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateNode(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode with LRO error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateNodeProgress without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkUpdateNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateNodeProgress with error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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.checkUpdateNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listNodes', () => { - it('invokes listNodes without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.INode[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodesStream without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - ]; - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { - 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.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodesStream with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), - ]; - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2.INode[] = []; - const iterable = client.listNodesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2.INode[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAcceleratorTypes', () => { - it('invokes listAcceleratorTypes without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listAcceleratorTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAcceleratorTypes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IAcceleratorType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAcceleratorTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypesStream without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.AcceleratorType) => { - 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.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAcceleratorTypesStream with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.AcceleratorType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; - const iterable = client.listAcceleratorTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAcceleratorTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRuntimeVersions', () => { - it('invokes listRuntimeVersions without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - ]; - client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimeVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersions without error using callback', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - ]; - client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRuntimeVersions( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2.IRuntimeVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersions with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimeVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRuntimeVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersionsStream without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - ]; - client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRuntimeVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { - 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.listRuntimeVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); - assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRuntimeVersionsStream with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRuntimeVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); - assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRuntimeVersions without error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), - ]; - client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; - const iterable = client.listRuntimeVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRuntimeVersions with error', async () => { - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRuntimeVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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 tpuModule.v2.TpuClient({ - 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('acceleratorType', () => { - const fakePath = "/rendered/path/acceleratorType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - accelerator_type: "acceleratorTypeValue", - }; - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.acceleratorTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.acceleratorTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('acceleratorTypePath', () => { - const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAcceleratorTypeName', () => { - const result = client.matchProjectFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAcceleratorTypeName', () => { - const result = client.matchLocationFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAcceleratorTypeFromAcceleratorTypeName', () => { - const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "acceleratorTypeValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new tpuModule.v2.TpuClient({ - 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('node', () => { - const fakePath = "/rendered/path/node"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - node: "nodeValue", - }; - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodePath', () => { - const result = client.nodePath("projectValue", "locationValue", "nodeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeName', () => { - const result = client.matchProjectFromNodeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeName', () => { - const result = client.matchLocationFromNodeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeFromNodeName', () => { - const result = client.matchNodeFromNodeName(fakePath); - assert.strictEqual(result, "nodeValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new tpuModule.v2.TpuClient({ - 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('runtimeVersion', () => { - const fakePath = "/rendered/path/runtimeVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - runtime_version: "runtimeVersionValue", - }; - const client = new tpuModule.v2.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.runtimeVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.runtimeVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('runtimeVersionPath', () => { - const result = client.runtimeVersionPath("projectValue", "locationValue", "runtimeVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRuntimeVersionName', () => { - const result = client.matchProjectFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRuntimeVersionName', () => { - const result = client.matchLocationFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuntimeVersionFromRuntimeVersionName', () => { - const result = client.matchRuntimeVersionFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "runtimeVersionValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-tpu/v2/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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-cloud-tpu/v2/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v2/webpack.config.js deleted file mode 100644 index 8ee514d072f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/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: 'Tpu', - filename: './tpu.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-cloud-tpu/v2alpha1/.eslintignore b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore b/owl-bot-staging/google-cloud-tpu/v2alpha1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.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-cloud-tpu/v2alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js deleted file mode 100644 index 5b3c57ae725..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/tpu', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md b/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md deleted file mode 100644 index b04db0dc280..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/README.md +++ /dev/null @@ -1 +0,0 @@ -Tpu: Nodejs Client diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/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-cloud-tpu/v2alpha1/package.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/package.json deleted file mode 100644 index 911441f5cee..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/tpu", - "version": "0.1.0", - "description": "Tpu client for Node.js", - "repository": "googleapis/nodejs-tpu", - "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 tpu", - "tpu", - "tpu" - ], - "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.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto deleted file mode 100644 index b6f0623b787..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto +++ /dev/null @@ -1,1169 +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.cloud.tpu.v2alpha1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/interval.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu"; -option java_multiple_files = true; -option java_outer_classname = "CloudTpuProto"; -option java_package = "com.google.cloud.tpu.v2alpha1"; - -// Manages TPU nodes and other resources -// -// TPU API v2alpha1 -service Tpu { - option (google.api.default_host) = "tpu.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists nodes. - rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { - option (google.api.http) = { - get: "/v2alpha1/{parent=projects/*/locations/*}/nodes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a node. - rpc GetNode(GetNodeRequest) returns (Node) { - option (google.api.http) = { - get: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a node. - rpc CreateNode(CreateNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha1/{parent=projects/*/locations/*}/nodes" - body: "node" - }; - option (google.api.method_signature) = "parent,node,node_id"; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a node. - rpc DeleteNode(DeleteNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2alpha1/{name=projects/*/locations/*/nodes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Stops a node. This operation is only available with single TPU nodes. - rpc StopNode(StopNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:stop" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Starts a node. - rpc StartNode(StartNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:start" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Updates the configurations of a node. - rpc UpdateNode(UpdateNodeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v2alpha1/{node.name=projects/*/locations/*/nodes/*}" - body: "node" - }; - option (google.api.method_signature) = "node,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } - - // Lists queued resources. - rpc ListQueuedResources(ListQueuedResourcesRequest) returns (ListQueuedResourcesResponse) { - option (google.api.http) = { - get: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a queued resource. - rpc GetQueuedResource(GetQueuedResourceRequest) returns (QueuedResource) { - option (google.api.http) = { - get: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a QueuedResource TPU instance. - rpc CreateQueuedResource(CreateQueuedResourceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" - body: "queued_resource" - }; - option (google.api.method_signature) = "parent,queued_resource,queued_resource_id"; - option (google.longrunning.operation_info) = { - response_type: "QueuedResource" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a QueuedResource TPU instance. - rpc DeleteQueuedResource(DeleteQueuedResourceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "QueuedResource" - metadata_type: "OperationMetadata" - }; - } - - // Generates the Cloud TPU service identity for the project. - rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) { - option (google.api.http) = { - post: "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity" - body: "*" - }; - } - - // Lists accelerator types supported by this API. - rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { - option (google.api.http) = { - get: "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets AcceleratorType. - rpc GetAcceleratorType(GetAcceleratorTypeRequest) returns (AcceleratorType) { - option (google.api.http) = { - get: "/v2alpha1/{name=projects/*/locations/*/acceleratorTypes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists runtime versions supported by this API. - rpc ListRuntimeVersions(ListRuntimeVersionsRequest) returns (ListRuntimeVersionsResponse) { - option (google.api.http) = { - get: "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a runtime version. - rpc GetRuntimeVersion(GetRuntimeVersionRequest) returns (RuntimeVersion) { - option (google.api.http) = { - get: "/v2alpha1/{name=projects/*/locations/*/runtimeVersions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Retrieves the guest attributes for the node. - rpc GetGuestAttributes(GetGuestAttributesRequest) returns (GetGuestAttributesResponse) { - option (google.api.http) = { - post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes" - body: "*" - }; - } - - // Simulates a maintenance event. - rpc SimulateMaintenanceEvent(SimulateMaintenanceEventRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "Node" - metadata_type: "OperationMetadata" - }; - } -} - -// A guest attributes. -message GuestAttributes { - // The path to be queried. This can be the default namespace ('/') or a - // nested namespace ('/\/') or a specified key - // ('/\/\') - string query_path = 1; - - // The value of the requested queried path. - GuestAttributesValue query_value = 2; -} - -// Array of guest attribute namespace/key/value tuples. -message GuestAttributesValue { - // The list of guest attributes entries. - repeated GuestAttributesEntry items = 1; -} - -// A guest attributes namespace/key/value entry. -message GuestAttributesEntry { - // Namespace for the guest attribute entry. - string namespace = 1; - - // Key for the guest attribute entry. - string key = 2; - - // Value for the guest attribute entry. - string value = 3; -} - -// A node-attached disk resource. -// Next ID: 8; -message AttachedDisk { - // The different mode of the attached disk. - enum DiskMode { - // The disk mode is not known/set. - DISK_MODE_UNSPECIFIED = 0; - - // Attaches the disk in read-write mode. Only one TPU node can attach a disk - // in read-write mode at a time. - READ_WRITE = 1; - - // Attaches the disk in read-only mode. Multiple TPU nodes can attach - // a disk in read-only mode at a time. - READ_ONLY = 2; - } - - // Specifies the full path to an existing disk. - // For example: "projects/my-project/zones/us-central1-c/disks/my-disk". - string source_disk = 3; - - // The mode in which to attach this disk. - // If not specified, the default is READ_WRITE mode. - // Only applicable to data_disks. - DiskMode mode = 4; -} - -// Sets the scheduling options for this node. -message SchedulingConfig { - // Defines whether the node is preemptible. - bool preemptible = 1; - - // Whether the node is created under a reservation. - bool reserved = 2; -} - -// A network endpoint over which a TPU worker can be reached. -message NetworkEndpoint { - // The internal IP address of this network endpoint. - string ip_address = 1; - - // The port of this network endpoint. - int32 port = 2; - - // The access config for the TPU worker. - AccessConfig access_config = 5; -} - -// An access config attached to the TPU worker. -message AccessConfig { - // Output only. An external IP address associated with the TPU worker. - string external_ip = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network related configurations. -message NetworkConfig { - // The name of the network for the TPU node. It must be a preexisting Google - // Compute Engine network. If none is provided, "default" will be used. - string network = 1; - - // The name of the subnetwork for the TPU node. It must be a preexisting - // Google Compute Engine subnetwork. If none is provided, "default" will be - // used. - string subnetwork = 2; - - // Indicates that external IP addresses would be associated with the TPU - // workers. If set to false, the specified subnetwork or network should have - // Private Google Access enabled. - bool enable_external_ips = 3; - - // Allows the TPU node to send and receive packets with non-matching - // destination or source IPs. This is required if you plan to use the TPU - // workers to forward routes. - bool can_ip_forward = 4; -} - -// A service account. -message ServiceAccount { - // Email address of the service account. If empty, default Compute service - // account will be used. - string email = 1; - - // The list of scopes to be made available for this service account. If empty, - // access to all Cloud APIs will be allowed. - repeated string scope = 2; -} - -// A TPU instance. -message Node { - option (google.api.resource) = { - type: "tpu.googleapis.com/Node" - pattern: "projects/{project}/locations/{location}/nodes/{node}" - }; - - // Represents the different states of a TPU node during its lifecycle. - enum State { - // TPU node state is not known/set. - STATE_UNSPECIFIED = 0; - - // TPU node is being created. - CREATING = 1; - - // TPU node has been created. - READY = 2; - - // TPU node is restarting. - RESTARTING = 3; - - // TPU node is undergoing reimaging. - REIMAGING = 4; - - // TPU node is being deleted. - DELETING = 5; - - // TPU node is being repaired and may be unusable. Details can be - // found in the 'help_description' field. - REPAIRING = 6; - - // TPU node is stopped. - STOPPED = 8; - - // TPU node is currently stopping. - STOPPING = 9; - - // TPU node is currently starting. - STARTING = 10; - - // TPU node has been preempted. Only applies to Preemptible TPU Nodes. - PREEMPTED = 11; - - // TPU node has been terminated due to maintenance or has reached the end of - // its life cycle (for preemptible nodes). - TERMINATED = 12; - - // TPU node is currently hiding. - HIDING = 13; - - // TPU node has been hidden. - HIDDEN = 14; - - // TPU node is currently unhiding. - UNHIDING = 15; - } - - // Health defines the status of a TPU node as reported by - // Health Monitor. - enum Health { - // Health status is unknown: not initialized or failed to retrieve. - HEALTH_UNSPECIFIED = 0; - - // The resource is healthy. - HEALTHY = 1; - - // The resource is unresponsive. - TIMEOUT = 3; - - // The in-guest ML stack is unhealthy. - UNHEALTHY_TENSORFLOW = 4; - - // The node is under maintenance/priority boost caused rescheduling and - // will resume running once rescheduled. - UNHEALTHY_MAINTENANCE = 5; - } - - // TPU API Version. - enum ApiVersion { - // API version is unknown. - API_VERSION_UNSPECIFIED = 0; - - // TPU API V1Alpha1 version. - V1_ALPHA1 = 1; - - // TPU API V1 version. - V1 = 2; - - // TPU API V2Alpha1 version. - V2_ALPHA1 = 3; - } - - // Output only. Immutable. The name of the TPU. - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IMMUTABLE - ]; - - // The user-supplied description of the TPU. Maximum of 512 characters. - string description = 3; - - // The type of hardware accelerators associated with this node. - string accelerator_type = 5; - - // Output only. The current state for the TPU Node. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this field is populated, it contains a description of why the TPU Node - // is unhealthy. - string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The runtime version running in the Node. - string runtime_version = 11 [(google.api.field_behavior) = REQUIRED]; - - // Network configurations for the TPU node. - NetworkConfig network_config = 36; - - // The CIDR block that the TPU node will use when selecting an IP address. - // This CIDR block must be a /29 block; the Compute Engine networks API - // forbids a smaller block, and using a larger block would be wasteful (a - // node can only consume one IP address). Errors will occur if the CIDR block - // has already been used for a currently existing TPU node, the CIDR block - // conflicts with any subnetworks in the user's provided network, or the - // provided network is peered with another network that is using that CIDR - // block. - string cidr_block = 13; - - // The Google Cloud Platform Service Account to be used by the TPU node VMs. - // If None is specified, the default compute service account will be used. - ServiceAccount service_account = 37; - - // Output only. The time when the node was created. - google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The scheduling options for this node. - SchedulingConfig scheduling_config = 17; - - // Output only. The network endpoints where TPU workers can be accessed and - // sent work. It is recommended that runtime clients of the node reach out - // to the 0th entry in this map first. - repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The health status of the TPU node. - Health health = 22; - - // Resource labels to represent user-provided metadata. - map labels = 24; - - // Custom metadata to apply to the TPU Node. - // Can set startup-script and shutdown-script - map metadata = 34; - - // Tags to apply to the TPU Node. Tags are used to identify valid sources or - // targets for network firewalls. - repeated string tags = 40; - - // Output only. The unique identifier for the TPU Node. - int64 id = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The additional data disks for the Node. - repeated AttachedDisk data_disks = 41; - - // Output only. The API version that created this Node. - ApiVersion api_version = 38 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Symptoms that have occurred to the TPU Node. - repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The qualified name of the QueuedResource that requested this Node. - string queued_resource = 43 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Shielded Instance options. - ShieldedInstanceConfig shielded_instance_config = 45; -} - -// A QueuedResource represents a request for resources that will be placed -// in a queue and fulfilled when the necessary resources are available. -message QueuedResource { - option (google.api.resource) = { - type: "tpu.googleapis.com/QueuedResource" - pattern: "projects/{project}/locations/{location}/queuedResources/{queued_resource}" - }; - - // Details of the TPU resource(s) being requested. - message Tpu { - // Details of the TPU node(s) being requested. Users can request either a - // single node or multiple nodes. - // NodeSpec provides the specification for node(s) to be created. - message NodeSpec { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ - // regex format. This is only specified when requesting a single node. - // In case of multi-node requests, multi_node_params must be populated - // instead. It's an error to specify both node_id and multi_node_params. - string node_id = 2; - - // Required. The node. - Node node = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // The TPU node(s) being requested. - repeated NodeSpec node_spec = 1; - } - - // BestEffort tier definition. - message BestEffort { - - } - - // Guaranteed tier definition. - message Guaranteed { - // Optional. Defines the minimum duration of the guarantee. If specified, - // the requested resources will only be provisioned if they can be - // allocated for at least the given duration. - google.protobuf.Duration min_duration = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the request should be scheduled on reserved capacity. - bool reserved = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Defines the policy of the QueuedRequest. - message QueueingPolicy { - // Time flexibility specification. - oneof start_timing_constraints { - // A relative time after which resources should not be created. - // If the request cannot be fulfilled by this time the request will be - // failed. - google.protobuf.Duration valid_until_duration = 1; - - // An absolute time after which resources should not be created. - // If the request cannot be fulfilled by this time the request will be - // failed. - google.protobuf.Timestamp valid_until_time = 2; - - // A relative time after which resources may be created. - google.protobuf.Duration valid_after_duration = 3; - - // An absolute time at which resources may be created. - google.protobuf.Timestamp valid_after_time = 4; - - // An absolute time interval within which resources may be created. - google.type.Interval valid_interval = 5; - } - } - - // Output only. Immutable. The name of the QueuedResource. - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Resource specification. - oneof resource { - // Defines a TPU resource. - Tpu tpu = 2; - } - - // Tier specifies the required tier. - oneof tier { - // The BestEffort tier. - BestEffort best_effort = 3; - - // The Guaranteed tier - Guaranteed guaranteed = 4; - } - - // The queueing policy of the QueuedRequest. - QueueingPolicy queueing_policy = 5; - - // Output only. State of the QueuedResource request - QueuedResourceState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// QueuedResourceState defines the details of the QueuedResource request. -message QueuedResourceState { - // Output only state of the request - enum State { - // State of the QueuedResource request is not known/set. - STATE_UNSPECIFIED = 0; - - // The QueuedResource request has been received. We're still working on - // determining if we will be able to honor this request. - CREATING = 1; - - // The QueuedResource request has passed initial validation/admission - // control and has been persisted in the queue. - ACCEPTED = 2; - - // The QueuedResource request has been selected. The - // associated resources are currently being provisioned (or very soon - // will begin provisioning). - PROVISIONING = 3; - - // The request could not be completed. This may be due to some - // late-discovered problem with the request itself, or due to - // unavailability of resources within the constraints of the request - // (e.g., the 'valid until' start timing constraint expired). - FAILED = 4; - - // The QueuedResource is being deleted. - DELETING = 5; - - // The resources specified in the QueuedResource request have been - // provisioned and are ready for use by the end-user/consumer. - ACTIVE = 6; - - // The resources specified in the QueuedResource request are being - // deleted. This may have been initiated by the user, or - // the Cloud TPU service. Inspect the state data for more details. - SUSPENDING = 7; - - // The resources specified in the QueuedResource request have been - // deleted. - SUSPENDED = 8; - } - - // Further data for the creating state. - message CreatingData { - - } - - // Further data for the accepted state. - message AcceptedData { - - } - - // Further data for the provisioning state. - message ProvisioningData { - - } - - // Further data for the failed state. - message FailedData { - // The error that caused the queued resource to enter the FAILED state. - google.rpc.Status error = 1; - } - - // Further data for the deleting state. - message DeletingData { - - } - - // Further data for the active state. - message ActiveData { - - } - - // Further data for the suspending state. - message SuspendingData { - - } - - // Further data for the suspended state. - message SuspendedData { - - } - - // State of the QueuedResource request. - State state = 1; - - // Further data for the state. - oneof state_data { - // Further data for the creating state. - CreatingData creating_data = 2; - - // Further data for the accepted state. - AcceptedData accepted_data = 3; - - // Further data for the provisioning state. - ProvisioningData provisioning_data = 4; - - // Further data for the failed state. - FailedData failed_data = 5; - - // Further data for the deleting state. - DeletingData deleting_data = 6; - - // Further data for the active state. - ActiveData active_data = 7; - - // Further data for the suspending state. - SuspendingData suspending_data = 8; - - // Further data for the suspended state. - SuspendedData suspended_data = 9; - } -} - -// Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. -message ListNodesRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/Node" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. -message ListNodesResponse { - // The listed nodes. - repeated Node nodes = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetNode][google.cloud.tpu.v2alpha1.Tpu.GetNode]. -message GetNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; -} - -// Request for [CreateNode][google.cloud.tpu.v2alpha1.Tpu.CreateNode]. -message CreateNodeRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The unqualified resource name. - string node_id = 2; - - // Required. The node. - Node node = 3 [(google.api.field_behavior) = REQUIRED]; - - // Idempotent request UUID. - string request_id = 6; -} - -// Request for [DeleteNode][google.cloud.tpu.v2alpha1.Tpu.DeleteNode]. -message DeleteNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; - - // Idempotent request UUID. - string request_id = 3; -} - -// Request for [StopNode][google.cloud.tpu.v2alpha1.Tpu.StopNode]. -message StopNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; -} - -// Request for [StartNode][google.cloud.tpu.v2alpha1.Tpu.StartNode]. -message StartNodeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; -} - -// Request for [UpdateNode][google.cloud.tpu.v2alpha1.Tpu.UpdateNode]. -message UpdateNodeRequest { - // Required. Mask of fields from [Node][Tpu.Node] to update. - // Supported fields: [description, tags, labels, metadata, - // network_config.enable_external_ips]. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The node. Only fields specified in update_mask are updated. - Node node = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. -message ListQueuedResourcesRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/QueuedResource" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; -} - -// Response for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. -message ListQueuedResourcesResponse { - // The listed queued resources. - repeated QueuedResource queued_resources = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetQueuedResource][google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource] -message GetQueuedResourceRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/QueuedResource" - } - ]; -} - -// Request for [CreateQueuedResource][google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource]. -message CreateQueuedResourceRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ - // regex format. - string queued_resource_id = 2; - - // Required. The queued resource. - QueuedResource queued_resource = 3 [(google.api.field_behavior) = REQUIRED]; - - // Idempotent request UUID. - string request_id = 4; -} - -// Request for [DeleteQueuedResource][google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource]. -message DeleteQueuedResourceRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/QueuedResource" - } - ]; - - // Idempotent request UUID. - string request_id = 2; -} - -// The per-product per-project service identity for Cloud TPU service. -message ServiceIdentity { - // The email address of the service identity. - string email = 1; -} - -// Request for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. -message GenerateServiceIdentityRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; -} - -// Response for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. -message GenerateServiceIdentityResponse { - // ServiceIdentity that was created or retrieved. - ServiceIdentity identity = 1; -} - -// A accelerator type that a Node can be configured with. -message AcceleratorType { - option (google.api.resource) = { - type: "tpu.googleapis.com/AcceleratorType" - pattern: "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" - }; - - // The resource name. - string name = 1; - - // The accelerator type. - string type = 2; -} - -// Request for [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType]. -message GetAcceleratorTypeRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/AcceleratorType" - } - ]; -} - -// Request for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. -message ListAcceleratorTypesRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/AcceleratorType" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; - - // List filter. - string filter = 5; - - // Sort results. - string order_by = 6; -} - -// Response for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. -message ListAcceleratorTypesResponse { - // The listed nodes. - repeated AcceleratorType accelerator_types = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// A runtime version that a Node can be configured with. -message RuntimeVersion { - option (google.api.resource) = { - type: "tpu.googleapis.com/RuntimeVersion" - pattern: "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" - }; - - // The resource name. - string name = 1; - - // The runtime version. - string version = 2; -} - -// Request for [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion]. -message GetRuntimeVersionRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/RuntimeVersion" - } - ]; -} - -// Request for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. -message ListRuntimeVersionsRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "tpu.googleapis.com/RuntimeVersion" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, if any. - string page_token = 3; - - // List filter. - string filter = 5; - - // Sort results. - string order_by = 6; -} - -// Response for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. -message ListRuntimeVersionsResponse { - // The listed nodes. - repeated RuntimeVersion runtime_versions = 1; - - // The next page token or empty if none. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Target of the operation - for example - // projects/project-1/connectivityTests/test-1 - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Specifies if cancellation was requested for the operation. - bool cancel_requested = 6; - - // API version. - string api_version = 7; -} - -// A Symptom instance. -message Symptom { - // SymptomType represents the different types of Symptoms that a TPU can be - // at. - enum SymptomType { - // Unspecified symptom. - SYMPTOM_TYPE_UNSPECIFIED = 0; - - // TPU VM memory is low. - LOW_MEMORY = 1; - - // TPU runtime is out of memory. - OUT_OF_MEMORY = 2; - - // TPU runtime execution has timed out. - EXECUTE_TIMED_OUT = 3; - - // TPU runtime fails to construct a mesh that recognizes each TPU device's - // neighbors. - MESH_BUILD_FAIL = 4; - - // TPU HBM is out of memory. - HBM_OUT_OF_MEMORY = 5; - - // Abusive behaviors have been identified on the current project. - PROJECT_ABUSE = 6; - } - - // Timestamp when the Symptom is created. - google.protobuf.Timestamp create_time = 1; - - // Type of the Symptom. - SymptomType symptom_type = 2; - - // Detailed information of the current Symptom. - string details = 3; - - // A string used to uniquely distinguish a worker within a TPU node. - string worker_id = 4; -} - -// Request for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. -message GetGuestAttributesRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; - - // The guest attributes path to be queried. - string query_path = 2; - - // The 0-based worker ID. If it is empty, all workers' GuestAttributes will be - // returned. - repeated string worker_ids = 3; -} - -// Response for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. -message GetGuestAttributesResponse { - // The guest attributes for the TPU workers. - repeated GuestAttributes guest_attributes = 1; -} - -// Request for [SimulateMaintenanceEvent][google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent]. -message SimulateMaintenanceEventRequest { - // Required. The resource name. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "tpu.googleapis.com/Node" - } - ]; - - // The 0-based worker ID. If it is empty, worker ID 0 will be selected for - // maintenance event simulation. A maintenance event will only be fired on the - // first specified worker ID. Future implementations may support firing on - // multiple workers. - repeated string worker_ids = 2; -} - -// A set of Shielded Instance options. -message ShieldedInstanceConfig { - // Defines whether the instance has Secure Boot enabled. - bool enable_secure_boot = 1; -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json deleted file mode 100644 index 839c736c173..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json +++ /dev/null @@ -1,831 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-tpu", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.tpu.v2alpha1", - "version": "v2alpha1" - } - ] - }, - "snippets": [ - { - "regionTag": "tpu_v2alpha1_generated_Tpu_ListNodes_async", - "title": "Tpu listNodes Sample", - "origin": "API_DEFINITION", - "description": " Lists nodes.", - "canonical": true, - "file": "tpu.list_nodes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListNodes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.ListNodesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "ListNodes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListNodes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GetNode_async", - "title": "Tpu getNode Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a node.", - "canonical": true, - "file": "tpu.get_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.Node", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GetNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_CreateNode_async", - "title": "Tpu createNode Sample", - "origin": "API_DEFINITION", - "description": " Creates a node.", - "canonical": true, - "file": "tpu.create_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateNode", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "node_id", - "type": "TYPE_STRING" - }, - { - "name": "node", - "type": ".google.cloud.tpu.v2alpha1.Node" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "CreateNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_DeleteNode_async", - "title": "Tpu deleteNode Sample", - "origin": "API_DEFINITION", - "description": " Deletes a node.", - "canonical": true, - "file": "tpu.delete_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "DeleteNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_StopNode_async", - "title": "Tpu stopNode Sample", - "origin": "API_DEFINITION", - "description": " Stops a node. This operation is only available with single TPU nodes.", - "canonical": true, - "file": "tpu.stop_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.StopNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "StopNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.StopNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_StartNode_async", - "title": "Tpu startNode Sample", - "origin": "API_DEFINITION", - "description": " Starts a node.", - "canonical": true, - "file": "tpu.start_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.StartNode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "StartNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.StartNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_UpdateNode_async", - "title": "Tpu updateNode Sample", - "origin": "API_DEFINITION", - "description": " Updates the configurations of a node.", - "canonical": true, - "file": "tpu.update_node.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.UpdateNode", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "node", - "type": ".google.cloud.tpu.v2alpha1.Node" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "UpdateNode", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.UpdateNode", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_ListQueuedResources_async", - "title": "Tpu listQueuedResources Sample", - "origin": "API_DEFINITION", - "description": " Lists queued resources.", - "canonical": true, - "file": "tpu.list_queued_resources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListQueuedResources", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "ListQueuedResources", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GetQueuedResource_async", - "title": "Tpu getQueuedResource Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a queued resource.", - "canonical": true, - "file": "tpu.get_queued_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.QueuedResource", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GetQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async", - "title": "Tpu createQueuedResource Sample", - "origin": "API_DEFINITION", - "description": " Creates a QueuedResource TPU instance.", - "canonical": true, - "file": "tpu.create_queued_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "queued_resource_id", - "type": "TYPE_STRING" - }, - { - "name": "queued_resource", - "type": ".google.cloud.tpu.v2alpha1.QueuedResource" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "CreateQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async", - "title": "Tpu deleteQueuedResource Sample", - "origin": "API_DEFINITION", - "description": " Deletes a QueuedResource TPU instance.", - "canonical": true, - "file": "tpu.delete_queued_resource.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "DeleteQueuedResource", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async", - "title": "Tpu generateServiceIdentity Sample", - "origin": "API_DEFINITION", - "description": " Generates the Cloud TPU service identity for the project.", - "canonical": true, - "file": "tpu.generate_service_identity.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateServiceIdentity", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GenerateServiceIdentity", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async", - "title": "Tpu listAcceleratorTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists accelerator types supported by this API.", - "canonical": true, - "file": "tpu.list_accelerator_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "ListAcceleratorTypes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async", - "title": "Tpu getAcceleratorType Sample", - "origin": "API_DEFINITION", - "description": " Gets AcceleratorType.", - "canonical": true, - "file": "tpu.get_accelerator_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.AcceleratorType", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GetAcceleratorType", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async", - "title": "Tpu listRuntimeVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists runtime versions supported by this API.", - "canonical": true, - "file": "tpu.list_runtime_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRuntimeVersions", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions", - "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" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "ListRuntimeVersions", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async", - "title": "Tpu getRuntimeVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets a runtime version.", - "canonical": true, - "file": "tpu.get_runtime_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRuntimeVersion", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.RuntimeVersion", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GetRuntimeVersion", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async", - "title": "Tpu getGuestAttributes Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the guest attributes for the node.", - "canonical": true, - "file": "tpu.get_guest_attributes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGuestAttributes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "query_path", - "type": "TYPE_STRING" - }, - { - "name": "worker_ids", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "GetGuestAttributes", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - }, - { - "regionTag": "tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async", - "title": "Tpu simulateMaintenanceEvent Sample", - "origin": "API_DEFINITION", - "description": " Simulates a maintenance event.", - "canonical": true, - "file": "tpu.simulate_maintenance_event.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SimulateMaintenanceEvent", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "worker_ids", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TpuClient", - "fullName": "google.cloud.tpu.v2alpha1.TpuClient" - }, - "method": { - "shortName": "SimulateMaintenanceEvent", - "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", - "service": { - "shortName": "Tpu", - "fullName": "google.cloud.tpu.v2alpha1.Tpu" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js deleted file mode 100644 index 98e5bbe23b2..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_node.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, node) { - // [START tpu_v2alpha1_generated_Tpu_CreateNode_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 name. - */ - // const parent = 'abc123' - /** - * The unqualified resource name. - */ - // const nodeId = 'abc123' - /** - * Required. The node. - */ - // const node = {} - /** - * Idempotent request UUID. - */ - // const requestId = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callCreateNode() { - // Construct request - const request = { - parent, - node, - }; - - // Run request - const [operation] = await tpuClient.createNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateNode(); - // [END tpu_v2alpha1_generated_Tpu_CreateNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js deleted file mode 100644 index 694da219d05..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_node.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_DeleteNode_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. - */ - // const name = 'abc123' - /** - * Idempotent request UUID. - */ - // const requestId = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callDeleteNode() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await tpuClient.deleteNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteNode(); - // [END tpu_v2alpha1_generated_Tpu_DeleteNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js deleted file mode 100644 index 6120c836015..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.generate_service_identity.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_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 name. - */ - // const parent = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGenerateServiceIdentity() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await tpuClient.generateServiceIdentity(request); - console.log(response); - } - - callGenerateServiceIdentity(); - // [END tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js deleted file mode 100644 index c09ba898d76..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_accelerator_type.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_GetAcceleratorType_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetAcceleratorType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getAcceleratorType(request); - console.log(response); - } - - callGetAcceleratorType(); - // [END tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js deleted file mode 100644 index e6b83bcafac..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_guest_attributes.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_GetGuestAttributes_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. - */ - // const name = 'abc123' - /** - * The guest attributes path to be queried. - */ - // const queryPath = 'abc123' - /** - * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be - * returned. - */ - // const workerIds = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetGuestAttributes() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getGuestAttributes(request); - console.log(response); - } - - callGetGuestAttributes(); - // [END tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js deleted file mode 100644 index ad9a1a2c833..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_node.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_GetNode_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetNode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getNode(request); - console.log(response); - } - - callGetNode(); - // [END tpu_v2alpha1_generated_Tpu_GetNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js deleted file mode 100644 index 8b9a3ee8556..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_runtime_version.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callGetRuntimeVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tpuClient.getRuntimeVersion(request); - console.log(response); - } - - callGetRuntimeVersion(); - // [END tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js deleted file mode 100644 index bbaeacf2d0d..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_accelerator_types.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - /** - * Sort results. - */ - // const orderBy = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListAcceleratorTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listAcceleratorTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAcceleratorTypes(); - // [END tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js deleted file mode 100644 index 4a43bdcc192..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_nodes.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v2alpha1_generated_Tpu_ListNodes_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListNodes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listNodesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNodes(); - // [END tpu_v2alpha1_generated_Tpu_ListNodes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js deleted file mode 100644 index ba51c03858c..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_runtime_versions.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_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 name. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - /** - * List filter. - */ - // const filter = 'abc123' - /** - * Sort results. - */ - // const orderBy = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callListRuntimeVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await tpuClient.listRuntimeVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRuntimeVersions(); - // [END tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js deleted file mode 100644 index a1f1418e8a4..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.start_node.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_StartNode_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callStartNode() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await tpuClient.startNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStartNode(); - // [END tpu_v2alpha1_generated_Tpu_StartNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js deleted file mode 100644 index 57304cc5003..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.stop_node.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START tpu_v2alpha1_generated_Tpu_StopNode_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. - */ - // const name = 'abc123' - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callStopNode() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await tpuClient.stopNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callStopNode(); - // [END tpu_v2alpha1_generated_Tpu_StopNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js deleted file mode 100644 index 642d3f00743..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.update_node.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, node) { - // [START tpu_v2alpha1_generated_Tpu_UpdateNode_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. Mask of fields from Node Tpu.Node to update. - * Supported fields: description, tags, labels, metadata, - * network_config.enable_external_ips. - */ - // const updateMask = {} - /** - * Required. The node. Only fields specified in update_mask are updated. - */ - // const node = {} - - // Imports the Tpu library - const {TpuClient} = require('@google-cloud/tpu').v2alpha1; - - // Instantiates a client - const tpuClient = new TpuClient(); - - async function callUpdateNode() { - // Construct request - const request = { - updateMask, - node, - }; - - // Run request - const [operation] = await tpuClient.updateNode(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateNode(); - // [END tpu_v2alpha1_generated_Tpu_UpdateNode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts deleted file mode 100644 index e00ff687292..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v2alpha1 from './v2alpha1'; -const TpuClient = v2alpha1.TpuClient; -type TpuClient = v2alpha1.TpuClient; -export {v2alpha1, TpuClient}; -export default {v2alpha1, TpuClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json deleted file mode 100644 index 521ba0b7c56..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/gapic_metadata.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.tpu.v2alpha1", - "libraryPackage": "@google-cloud/tpu", - "services": { - "Tpu": { - "clients": { - "grpc": { - "libraryClient": "TpuClient", - "rpcs": { - "GetNode": { - "methods": [ - "getNode" - ] - }, - "GetQueuedResource": { - "methods": [ - "getQueuedResource" - ] - }, - "GenerateServiceIdentity": { - "methods": [ - "generateServiceIdentity" - ] - }, - "GetAcceleratorType": { - "methods": [ - "getAcceleratorType" - ] - }, - "GetRuntimeVersion": { - "methods": [ - "getRuntimeVersion" - ] - }, - "GetGuestAttributes": { - "methods": [ - "getGuestAttributes" - ] - }, - "CreateNode": { - "methods": [ - "createNode" - ] - }, - "DeleteNode": { - "methods": [ - "deleteNode" - ] - }, - "StopNode": { - "methods": [ - "stopNode" - ] - }, - "StartNode": { - "methods": [ - "startNode" - ] - }, - "UpdateNode": { - "methods": [ - "updateNode" - ] - }, - "CreateQueuedResource": { - "methods": [ - "createQueuedResource" - ] - }, - "DeleteQueuedResource": { - "methods": [ - "deleteQueuedResource" - ] - }, - "SimulateMaintenanceEvent": { - "methods": [ - "simulateMaintenanceEvent" - ] - }, - "ListNodes": { - "methods": [ - "listNodes", - "listNodesStream", - "listNodesAsync" - ] - }, - "ListQueuedResources": { - "methods": [ - "listQueuedResources", - "listQueuedResourcesStream", - "listQueuedResourcesAsync" - ] - }, - "ListAcceleratorTypes": { - "methods": [ - "listAcceleratorTypes", - "listAcceleratorTypesStream", - "listAcceleratorTypesAsync" - ] - }, - "ListRuntimeVersions": { - "methods": [ - "listRuntimeVersions", - "listRuntimeVersionsStream", - "listRuntimeVersionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TpuClient", - "rpcs": { - "GetNode": { - "methods": [ - "getNode" - ] - }, - "GetQueuedResource": { - "methods": [ - "getQueuedResource" - ] - }, - "GenerateServiceIdentity": { - "methods": [ - "generateServiceIdentity" - ] - }, - "GetAcceleratorType": { - "methods": [ - "getAcceleratorType" - ] - }, - "GetRuntimeVersion": { - "methods": [ - "getRuntimeVersion" - ] - }, - "GetGuestAttributes": { - "methods": [ - "getGuestAttributes" - ] - }, - "CreateNode": { - "methods": [ - "createNode" - ] - }, - "DeleteNode": { - "methods": [ - "deleteNode" - ] - }, - "StopNode": { - "methods": [ - "stopNode" - ] - }, - "StartNode": { - "methods": [ - "startNode" - ] - }, - "UpdateNode": { - "methods": [ - "updateNode" - ] - }, - "CreateQueuedResource": { - "methods": [ - "createQueuedResource" - ] - }, - "DeleteQueuedResource": { - "methods": [ - "deleteQueuedResource" - ] - }, - "SimulateMaintenanceEvent": { - "methods": [ - "simulateMaintenanceEvent" - ] - }, - "ListNodes": { - "methods": [ - "listNodes", - "listNodesStream", - "listNodesAsync" - ] - }, - "ListQueuedResources": { - "methods": [ - "listQueuedResources", - "listQueuedResourcesStream", - "listQueuedResourcesAsync" - ] - }, - "ListAcceleratorTypes": { - "methods": [ - "listAcceleratorTypes", - "listAcceleratorTypesStream", - "listAcceleratorTypesAsync" - ] - }, - "ListRuntimeVersions": { - "methods": [ - "listRuntimeVersions", - "listRuntimeVersionsStream", - "listRuntimeVersionsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts deleted file mode 100644 index 27c81814923..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {TpuClient} from './tpu_client'; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts deleted file mode 100644 index b7a8e23d255..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client.ts +++ /dev/null @@ -1,2862 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, 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/v2alpha1/tpu_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './tpu_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages TPU nodes and other resources - * - * TPU API v2alpha1 - * @class - * @memberof v2alpha1 - */ -export class TpuClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - tpuStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TpuClient. - * - * @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 TpuClient({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 TpuClient; - 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.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 = { - acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - nodePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/nodes/{node}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - queuedResourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/queuedResources/{queued_resource}' - ), - runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' - ), - }; - - // 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 = { - listNodes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), - listQueuedResources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'queuedResources'), - listAcceleratorTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'acceleratorTypes'), - listRuntimeVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'runtimeVersions') - }; - - 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.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*}',},{get: '/v2/{name=projects/*/locations/*}',}], - },{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',additional_bindings: [{get: '/v1/{name=projects/*}/locations',},{get: '/v2alpha1/{name=projects/*}/locations',},{get: '/v2/{name=projects/*}/locations',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',additional_bindings: [{post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel',},{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{delete: '/v1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{delete: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha1/{name=projects/*/locations/*/operations/*}',},{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',additional_bindings: [{get: '/v1/{name=projects/*/locations/*}/operations',},{get: '/v2alpha1/{name=projects/*/locations/*}/operations',},{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; - const createNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteNodeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const stopNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; - const stopNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const startNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; - const startNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const updateNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; - const updateNodeMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const createQueuedResourceResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.QueuedResource') as gax.protobuf.Type; - const createQueuedResourceMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteQueuedResourceResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.QueuedResource') as gax.protobuf.Type; - const deleteQueuedResourceMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - const simulateMaintenanceEventResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node') as gax.protobuf.Type; - const simulateMaintenanceEventMetadata = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createNodeResponse.decode.bind(createNodeResponse), - createNodeMetadata.decode.bind(createNodeMetadata)), - deleteNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteNodeResponse.decode.bind(deleteNodeResponse), - deleteNodeMetadata.decode.bind(deleteNodeMetadata)), - stopNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - stopNodeResponse.decode.bind(stopNodeResponse), - stopNodeMetadata.decode.bind(stopNodeMetadata)), - startNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - startNodeResponse.decode.bind(startNodeResponse), - startNodeMetadata.decode.bind(startNodeMetadata)), - updateNode: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateNodeResponse.decode.bind(updateNodeResponse), - updateNodeMetadata.decode.bind(updateNodeMetadata)), - createQueuedResource: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createQueuedResourceResponse.decode.bind(createQueuedResourceResponse), - createQueuedResourceMetadata.decode.bind(createQueuedResourceMetadata)), - deleteQueuedResource: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteQueuedResourceResponse.decode.bind(deleteQueuedResourceResponse), - deleteQueuedResourceMetadata.decode.bind(deleteQueuedResourceMetadata)), - simulateMaintenanceEvent: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - simulateMaintenanceEventResponse.decode.bind(simulateMaintenanceEventResponse), - simulateMaintenanceEventMetadata.decode.bind(simulateMaintenanceEventMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.tpu.v2alpha1.Tpu', 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.tpuStub) { - return this.tpuStub; - } - - // Put together the "service stub" for - // google.cloud.tpu.v2alpha1.Tpu. - this.tpuStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.tpu.v2alpha1.Tpu') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.tpu.v2alpha1.Tpu, - 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 tpuStubMethods = - ['listNodes', 'getNode', 'createNode', 'deleteNode', 'stopNode', 'startNode', 'updateNode', 'listQueuedResources', 'getQueuedResource', 'createQueuedResource', 'deleteQueuedResource', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes', 'simulateMaintenanceEvent']; - for (const methodName of tpuStubMethods) { - const callPromise = this.tpuStub.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.tpuStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'tpu.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 'tpu.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 the details of a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. - * 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/v2alpha1/tpu.get_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_GetNode_async - */ - getNode( - request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|undefined, {}|undefined - ]>; - getNode( - request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; - getNode( - request?: protos.google.cloud.tpu.v2alpha1.IGetNodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.INode, - protos.google.cloud.tpu.v2alpha1.IGetNodeRequest|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.getNode(request, options, callback); - } -/** - * Gets details of a queued resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. - * 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/v2alpha1/tpu.get_queued_resource.js - * region_tag:tpu_v2alpha1_generated_Tpu_GetQueuedResource_async - */ - getQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|undefined, {}|undefined - ]>; - getQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, - {}|null|undefined>): void; - getQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, - {}|null|undefined>): void; - getQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IQueuedResource, - protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest|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.getQueuedResource(request, options, callback); - } -/** - * Generates the Cloud TPU service identity for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @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 [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse}. - * 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/v2alpha1/tpu.generate_service_identity.js - * region_tag:tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async - */ - generateServiceIdentity( - request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|undefined, {}|undefined - ]>; - generateServiceIdentity( - request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): void; - generateServiceIdentity( - request: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): void; - generateServiceIdentity( - request?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse, - protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest|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.generateServiceIdentity(request, options, callback); - } -/** - * Gets AcceleratorType. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. - * 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/v2alpha1/tpu.get_accelerator_type.js - * region_tag:tpu_v2alpha1_generated_Tpu_GetAcceleratorType_async - */ - getAcceleratorType( - request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|undefined, {}|undefined - ]>; - getAcceleratorType( - request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): void; - getAcceleratorType( - request?: protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IAcceleratorType, - protos.google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest|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.getAcceleratorType(request, options, callback); - } -/** - * Gets a runtime version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. - * 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/v2alpha1/tpu.get_runtime_version.js - * region_tag:tpu_v2alpha1_generated_Tpu_GetRuntimeVersion_async - */ - getRuntimeVersion( - request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|undefined, {}|undefined - ]>; - getRuntimeVersion( - request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): void; - getRuntimeVersion( - request: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): void; - getRuntimeVersion( - request?: protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion, - protos.google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest|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.getRuntimeVersion(request, options, callback); - } -/** - * Retrieves the guest attributes for the node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @param {string} request.queryPath - * The guest attributes path to be queried. - * @param {string[]} request.workerIds - * The 0-based worker ID. If it is empty, all workers' GuestAttributes 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 [GetGuestAttributesResponse]{@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse}. - * 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/v2alpha1/tpu.get_guest_attributes.js - * region_tag:tpu_v2alpha1_generated_Tpu_GetGuestAttributes_async - */ - getGuestAttributes( - request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|undefined, {}|undefined - ]>; - getGuestAttributes( - request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): void; - getGuestAttributes( - request: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, - callback: Callback< - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): void; - getGuestAttributes( - request?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse, - protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest|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.getGuestAttributes(request, options, callback); - } - -/** - * Creates a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {string} request.nodeId - * The unqualified resource name. - * @param {google.cloud.tpu.v2alpha1.Node} request.node - * Required. The node. - * @param {string} request.requestId - * Idempotent request UUID. - * @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/v2alpha1/tpu.create_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_CreateNode_async - */ - createNode( - request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createNode( - request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createNode( - request?: protos.google.cloud.tpu.v2alpha1.ICreateNodeRequest, - 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.createNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createNode()`. - * @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/v2alpha1/tpu.create_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_CreateNode_async - */ - async checkCreateNodeProgress(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.createNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @param {string} request.requestId - * Idempotent request UUID. - * @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/v2alpha1/tpu.delete_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_DeleteNode_async - */ - deleteNode( - request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteNode( - request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteNode( - request?: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, - 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.deleteNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteNode()`. - * @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/v2alpha1/tpu.delete_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_DeleteNode_async - */ - async checkDeleteNodeProgress(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.deleteNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Stops a node. This operation is only available with single TPU nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/v2alpha1/tpu.stop_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_StopNode_async - */ - stopNode( - request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - stopNode( - request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - stopNode( - request?: protos.google.cloud.tpu.v2alpha1.IStopNodeRequest, - 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.stopNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `stopNode()`. - * @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/v2alpha1/tpu.stop_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_StopNode_async - */ - async checkStopNodeProgress(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.stopNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @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/v2alpha1/tpu.start_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_StartNode_async - */ - startNode( - request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - startNode( - request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - startNode( - request?: protos.google.cloud.tpu.v2alpha1.IStartNodeRequest, - 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.startNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `startNode()`. - * @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/v2alpha1/tpu.start_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_StartNode_async - */ - async checkStartNodeProgress(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.startNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the configurations of a node. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields from {@link Tpu.Node|Node} to update. - * Supported fields: [description, tags, labels, metadata, - * network_config.enable_external_ips]. - * @param {google.cloud.tpu.v2alpha1.Node} request.node - * Required. The node. Only fields specified in update_mask are updated. - * @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/v2alpha1/tpu.update_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_UpdateNode_async - */ - updateNode( - request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateNode( - request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNode( - request: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateNode( - request?: protos.google.cloud.tpu.v2alpha1.IUpdateNodeRequest, - 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({ - 'node.name': request.node!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateNode(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateNode()`. - * @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/v2alpha1/tpu.update_node.js - * region_tag:tpu_v2alpha1_generated_Tpu_UpdateNode_async - */ - async checkUpdateNodeProgress(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.updateNode, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a QueuedResource TPU instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {string} request.queuedResourceId - * The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ - * regex format. - * @param {google.cloud.tpu.v2alpha1.QueuedResource} request.queuedResource - * Required. The queued resource. - * @param {string} request.requestId - * Idempotent request UUID. - * @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/v2alpha1/tpu.create_queued_resource.js - * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async - */ - createQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, - 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.createQueuedResource(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createQueuedResource()`. - * @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/v2alpha1/tpu.create_queued_resource.js - * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async - */ - async checkCreateQueuedResourceProgress(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.createQueuedResource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a QueuedResource TPU instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @param {string} request.requestId - * Idempotent request UUID. - * @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/v2alpha1/tpu.delete_queued_resource.js - * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async - */ - deleteQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteQueuedResource( - request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteQueuedResource( - request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, - 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.deleteQueuedResource(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteQueuedResource()`. - * @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/v2alpha1/tpu.delete_queued_resource.js - * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async - */ - async checkDeleteQueuedResourceProgress(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.deleteQueuedResource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Simulates a maintenance event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name. - * @param {string[]} request.workerIds - * The 0-based worker ID. If it is empty, worker ID 0 will be selected for - * maintenance event simulation. A maintenance event will only be fired on the - * first specified worker ID. Future implementations may support firing on - * multiple workers. - * @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/v2alpha1/tpu.simulate_maintenance_event.js - * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async - */ - simulateMaintenanceEvent( - request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - simulateMaintenanceEvent( - request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - simulateMaintenanceEvent( - request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - simulateMaintenanceEvent( - request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, - 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.simulateMaintenanceEvent(request, options, callback); - } -/** - * Check the status of the long running operation returned by `simulateMaintenanceEvent()`. - * @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/v2alpha1/tpu.simulate_maintenance_event.js - * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async - */ - async checkSimulateMaintenanceEventProgress(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.simulateMaintenanceEvent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists nodes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. - * 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 `listNodesAsync()` - * 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. - */ - listNodes( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.INode[], - protos.google.cloud.tpu.v2alpha1.IListNodesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse - ]>; - listNodes( - request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.INode>): void; - listNodes( - request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.INode>): void; - listNodes( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.INode>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.INode>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.INode[], - protos.google.cloud.tpu.v2alpha1.IListNodesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse - ]>|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.listNodes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node} 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 `listNodesAsync()` - * 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. - */ - listNodesStream( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNodes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 - * [Node]{@link google.cloud.tpu.v2alpha1.Node}. 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/v2alpha1/tpu.list_nodes.js - * region_tag:tpu_v2alpha1_generated_Tpu_ListNodes_async - */ - listNodesAsync( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.asyncIterate( - this.innerApiCalls['listNodes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists queued resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. - * 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 `listQueuedResourcesAsync()` - * 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. - */ - listQueuedResources( - request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IQueuedResource[], - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse - ]>; - listQueuedResources( - request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IQueuedResource>): void; - listQueuedResources( - request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IQueuedResource>): void; - listQueuedResources( - request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IQueuedResource>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IQueuedResource>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IQueuedResource[], - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse - ]>|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.listQueuedResources(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource} 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 `listQueuedResourcesAsync()` - * 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. - */ - listQueuedResourcesStream( - request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - 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['listQueuedResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listQueuedResources.createStream( - this.innerApiCalls.listQueuedResources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listQueuedResources`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 - * [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. 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/v2alpha1/tpu.list_queued_resources.js - * region_tag:tpu_v2alpha1_generated_Tpu_ListQueuedResources_async - */ - listQueuedResourcesAsync( - request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, - 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['listQueuedResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listQueuedResources.asyncIterate( - this.innerApiCalls['listQueuedResources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists accelerator types supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. - * 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse - ]>; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): void; - listAcceleratorTypes( - request: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): void; - listAcceleratorTypes( - request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IAcceleratorType>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IAcceleratorType>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IAcceleratorType[], - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest|null, - protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse - ]>|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.listAcceleratorTypes(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType} 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 `listAcceleratorTypesAsync()` - * 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. - */ - listAcceleratorTypesStream( - request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.createStream( - this.innerApiCalls.listAcceleratorTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAcceleratorTypes`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [AcceleratorType]{@link google.cloud.tpu.v2alpha1.AcceleratorType}. 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/v2alpha1/tpu.list_accelerator_types.js - * region_tag:tpu_v2alpha1_generated_Tpu_ListAcceleratorTypes_async - */ - listAcceleratorTypesAsync( - request?: protos.google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, - 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['listAcceleratorTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAcceleratorTypes.asyncIterate( - this.innerApiCalls['listAcceleratorTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists runtime versions supported by this API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. - * 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 `listRuntimeVersionsAsync()` - * 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. - */ - listRuntimeVersions( - request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest|null, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse - ]>; - listRuntimeVersions( - request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): void; - listRuntimeVersions( - request: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): void; - listRuntimeVersions( - request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse|null|undefined, - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion>): - Promise<[ - protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[], - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest|null, - protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse - ]>|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.listRuntimeVersions(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion} 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 `listRuntimeVersionsAsync()` - * 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. - */ - listRuntimeVersionsStream( - request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - 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['listRuntimeVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRuntimeVersions.createStream( - this.innerApiCalls.listRuntimeVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRuntimeVersions`, 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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @param {string} request.filter - * List filter. - * @param {string} request.orderBy - * Sort 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 - * [RuntimeVersion]{@link google.cloud.tpu.v2alpha1.RuntimeVersion}. 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/v2alpha1/tpu.list_runtime_versions.js - * region_tag:tpu_v2alpha1_generated_Tpu_ListRuntimeVersions_async - */ - listRuntimeVersionsAsync( - request?: protos.google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, - 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['listRuntimeVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRuntimeVersions.asyncIterate( - this.innerApiCalls['listRuntimeVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * 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 [Location]{@link google.cloud.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 - * [Location]{@link google.cloud.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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} accelerator_type - * @returns {string} Resource name string. - */ - acceleratorTypePath(project:string,location:string,acceleratorType:string) { - return this.pathTemplates.acceleratorTypePathTemplate.render({ - project: project, - location: location, - accelerator_type: acceleratorType, - }); - } - - /** - * Parse the project from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).project; - } - - /** - * Parse the location from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).location; - } - - /** - * Parse the accelerator_type from AcceleratorType resource. - * - * @param {string} acceleratorTypeName - * A fully-qualified path representing AcceleratorType resource. - * @returns {string} A string representing the accelerator_type. - */ - matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { - return this.pathTemplates.acceleratorTypePathTemplate.match(acceleratorTypeName).accelerator_type; - } - - /** - * 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 node resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} node - * @returns {string} Resource name string. - */ - nodePath(project:string,location:string,node:string) { - return this.pathTemplates.nodePathTemplate.render({ - project: project, - location: location, - node: node, - }); - } - - /** - * Parse the project from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).project; - } - - /** - * Parse the location from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the location. - */ - matchLocationFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).location; - } - - /** - * Parse the node from Node resource. - * - * @param {string} nodeName - * A fully-qualified path representing Node resource. - * @returns {string} A string representing the node. - */ - matchNodeFromNodeName(nodeName: string) { - return this.pathTemplates.nodePathTemplate.match(nodeName).node; - } - - /** - * 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 queuedResource resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} queued_resource - * @returns {string} Resource name string. - */ - queuedResourcePath(project:string,location:string,queuedResource:string) { - return this.pathTemplates.queuedResourcePathTemplate.render({ - project: project, - location: location, - queued_resource: queuedResource, - }); - } - - /** - * Parse the project from QueuedResource resource. - * - * @param {string} queuedResourceName - * A fully-qualified path representing QueuedResource resource. - * @returns {string} A string representing the project. - */ - matchProjectFromQueuedResourceName(queuedResourceName: string) { - return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).project; - } - - /** - * Parse the location from QueuedResource resource. - * - * @param {string} queuedResourceName - * A fully-qualified path representing QueuedResource resource. - * @returns {string} A string representing the location. - */ - matchLocationFromQueuedResourceName(queuedResourceName: string) { - return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).location; - } - - /** - * Parse the queued_resource from QueuedResource resource. - * - * @param {string} queuedResourceName - * A fully-qualified path representing QueuedResource resource. - * @returns {string} A string representing the queued_resource. - */ - matchQueuedResourceFromQueuedResourceName(queuedResourceName: string) { - return this.pathTemplates.queuedResourcePathTemplate.match(queuedResourceName).queued_resource; - } - - /** - * Return a fully-qualified runtimeVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} runtime_version - * @returns {string} Resource name string. - */ - runtimeVersionPath(project:string,location:string,runtimeVersion:string) { - return this.pathTemplates.runtimeVersionPathTemplate.render({ - project: project, - location: location, - runtime_version: runtimeVersion, - }); - } - - /** - * Parse the project from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).project; - } - - /** - * Parse the location from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).location; - } - - /** - * Parse the runtime_version from RuntimeVersion resource. - * - * @param {string} runtimeVersionName - * A fully-qualified path representing RuntimeVersion resource. - * @returns {string} A string representing the runtime_version. - */ - matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { - return this.pathTemplates.runtimeVersionPathTemplate.match(runtimeVersionName).runtime_version; - } - - /** - * 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.tpuStub && !this._terminated) { - return this.tpuStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json deleted file mode 100644 index 5adc5503d1e..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_client_config.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "interfaces": { - "google.cloud.tpu.v2alpha1.Tpu": { - "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": { - "ListNodes": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNode": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListQueuedResources": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetQueuedResource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateQueuedResource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteQueuedResource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateServiceIdentity": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListAcceleratorTypes": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAcceleratorType": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRuntimeVersions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRuntimeVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGuestAttributes": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SimulateMaintenanceEvent": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json deleted file mode 100644 index 17217f28408..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/src/v2alpha1/tpu_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto" -] diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 9cb87c17e68..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const tpu = require('@google-cloud/tpu'); - -function main() { - const tpuClient = new tpu.TpuClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 50ac473b84f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {TpuClient} from '@google-cloud/tpu'; - -// check that the client class type name can be used -function doStuffWithTpuClient(client: TpuClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const tpuClient = new TpuClient(); - doStuffWithTpuClient(tpuClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts b/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts deleted file mode 100644 index 60380c5a6e3..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/test/gapic_tpu_v2alpha1.ts +++ /dev/null @@ -1,3753 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as tpuModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, 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('v2alpha1.TpuClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = tpuModule.v2alpha1.TpuClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = tpuModule.v2alpha1.TpuClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = tpuModule.v2alpha1.TpuClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new tpuModule.v2alpha1.TpuClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new tpuModule.v2alpha1.TpuClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - await client.initialize(); - assert(client.tpuStub); - }); - - it('has close method for the initialized client', done => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.tpuStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tpuStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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('getNode', () => { - it('invokes getNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); - const [response] = await client.getNode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNode( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.INode|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNode with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNode(request), expectedError); - }); - }); - - describe('getQueuedResource', () => { - it('invokes getQueuedResource without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.QueuedResource() - ); - client.innerApiCalls.getQueuedResource = stubSimpleCall(expectedResponse); - const [response] = await client.getQueuedResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueuedResource without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.QueuedResource() - ); - client.innerApiCalls.getQueuedResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getQueuedResource( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueuedResource with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getQueuedResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getQueuedResource(request), expectedError); - const actualRequest = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueuedResource with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getQueuedResource(request), expectedError); - }); - }); - - describe('generateServiceIdentity', () => { - it('invokes generateServiceIdentity without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() - ); - client.innerApiCalls.generateServiceIdentity = stubSimpleCall(expectedResponse); - const [response] = await client.generateServiceIdentity(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse() - ); - client.innerApiCalls.generateServiceIdentity = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateServiceIdentity( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateServiceIdentity = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateServiceIdentity(request), expectedError); - const actualRequest = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateServiceIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateServiceIdentity with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.generateServiceIdentity(request), expectedError); - }); - }); - - describe('getAcceleratorType', () => { - it('invokes getAcceleratorType without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(expectedResponse); - const [response] = await client.getAcceleratorType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() - ); - client.innerApiCalls.getAcceleratorType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAcceleratorType( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAcceleratorType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAcceleratorType(request), expectedError); - const actualRequest = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAcceleratorType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAcceleratorType with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAcceleratorType(request), expectedError); - }); - }); - - describe('getRuntimeVersion', () => { - it('invokes getRuntimeVersion without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ); - client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getRuntimeVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ); - client.innerApiCalls.getRuntimeVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRuntimeVersion( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRuntimeVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRuntimeVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRuntimeVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRuntimeVersion with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRuntimeVersion(request), expectedError); - }); - }); - - describe('getGuestAttributes', () => { - it('invokes getGuestAttributes without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() - ); - client.innerApiCalls.getGuestAttributes = stubSimpleCall(expectedResponse); - const [response] = await client.getGuestAttributes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse() - ); - client.innerApiCalls.getGuestAttributes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGuestAttributes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGuestAttributes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGuestAttributes(request), expectedError); - const actualRequest = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGuestAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGuestAttributes with closed client', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getGuestAttributes(request), expectedError); - }); - }); - - describe('createNode', () => { - it('invokes createNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNode( - 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.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNode(request), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNode with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateNodeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateNodeProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkCreateNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateNodeProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkCreateNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteNode', () => { - it('invokes deleteNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNode( - 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.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNode(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNode with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteNodeProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkDeleteNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteNodeProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkDeleteNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('stopNode', () => { - it('invokes stopNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.stopNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.stopNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopNode( - 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.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.stopNode(request), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopNode with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StopNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StopNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.stopNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStopNodeProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkStopNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStopNodeProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkStopNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('startNode', () => { - it('invokes startNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.startNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startNode( - 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.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startNode(request), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startNode with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.StartNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.StartNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkStartNodeProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkStartNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkStartNodeProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkStartNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateNode', () => { - it('invokes updateNode without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateNode(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNode = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNode( - 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.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNode = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateNode(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNode with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.UpdateNodeRequest() - ); - request.node ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.UpdateNodeRequest', ['node', 'name']); - request.node.name = defaultValue1; - const expectedHeaderRequestParams = `node.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNode = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateNode(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateNodeProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkUpdateNodeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateNodeProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkUpdateNodeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createQueuedResource', () => { - it('invokes createQueuedResource without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createQueuedResource = stubLongRunningCall(expectedResponse); - const [operation] = await client.createQueuedResource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueuedResource without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createQueuedResource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createQueuedResource( - 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.createQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueuedResource with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createQueuedResource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createQueuedResource(request), expectedError); - const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueuedResource with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createQueuedResource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createQueuedResource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateQueuedResourceProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkCreateQueuedResourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateQueuedResourceProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkCreateQueuedResourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteQueuedResource', () => { - it('invokes deleteQueuedResource without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteQueuedResource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueuedResource without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteQueuedResource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteQueuedResource( - 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.deleteQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueuedResource with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteQueuedResource(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueuedResource with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteQueuedResource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteQueuedResource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueuedResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteQueuedResourceProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkDeleteQueuedResourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteQueuedResourceProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkDeleteQueuedResourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('simulateMaintenanceEvent', () => { - it('invokes simulateMaintenanceEvent without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(expectedResponse); - const [operation] = await client.simulateMaintenanceEvent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes simulateMaintenanceEvent without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.simulateMaintenanceEvent( - 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.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes simulateMaintenanceEvent with call error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.simulateMaintenanceEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes simulateMaintenanceEvent with LRO error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.simulateMaintenanceEvent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.simulateMaintenanceEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSimulateMaintenanceEventProgress without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkSimulateMaintenanceEventProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSimulateMaintenanceEventProgress with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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.checkSimulateMaintenanceEventProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listNodes', () => { - it('invokes listNodes without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.INode[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodes with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodesStream without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { - 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.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodesStream with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; - const iterable = client.listNodesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listQueuedResources', () => { - it('invokes listQueuedResources without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - ]; - client.innerApiCalls.listQueuedResources = stubSimpleCall(expectedResponse); - const [response] = await client.listQueuedResources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueuedResources without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - ]; - client.innerApiCalls.listQueuedResources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listQueuedResources( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueuedResources with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listQueuedResources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listQueuedResources(request), expectedError); - const actualRequest = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueuedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueuedResourcesStream without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - ]; - client.descriptors.page.listQueuedResources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listQueuedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { - 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.listQueuedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueuedResources, request)); - assert( - (client.descriptors.page.listQueuedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listQueuedResourcesStream with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueuedResources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listQueuedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listQueuedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueuedResources, request)); - assert( - (client.descriptors.page.listQueuedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueuedResources without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.QueuedResource()), - ]; - client.descriptors.page.listQueuedResources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = []; - const iterable = client.listQueuedResourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueuedResources with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueuedResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listQueuedResourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listAcceleratorTypes', () => { - it('invokes listAcceleratorTypes without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listAcceleratorTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - ]; - client.innerApiCalls.listAcceleratorTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAcceleratorTypes( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypes with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAcceleratorTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAcceleratorTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAcceleratorTypesStream without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { - 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.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAcceleratorTypesStream with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAcceleratorTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAcceleratorTypes, request)); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.AcceleratorType()), - ]; - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; - const iterable = client.listAcceleratorTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAcceleratorTypes with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAcceleratorTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRuntimeVersions', () => { - it('invokes listRuntimeVersions without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - ]; - client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimeVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersions without error using callback', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - ]; - client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRuntimeVersions( - request, - (err?: Error|null, result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersions with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimeVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRuntimeVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRuntimeVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRuntimeVersionsStream without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - ]; - client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRuntimeVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { - 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.listRuntimeVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); - assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRuntimeVersionsStream with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRuntimeVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRuntimeVersions, request)); - assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRuntimeVersions without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.RuntimeVersion()), - ]; - client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; - const iterable = client.listRuntimeVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRuntimeVersions with error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRuntimeVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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 tpuModule.v2alpha1.TpuClient({ - 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('acceleratorType', () => { - const fakePath = "/rendered/path/acceleratorType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - accelerator_type: "acceleratorTypeValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.acceleratorTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.acceleratorTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('acceleratorTypePath', () => { - const result = client.acceleratorTypePath("projectValue", "locationValue", "acceleratorTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAcceleratorTypeName', () => { - const result = client.matchProjectFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAcceleratorTypeName', () => { - const result = client.matchLocationFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAcceleratorTypeFromAcceleratorTypeName', () => { - const result = client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); - assert.strictEqual(result, "acceleratorTypeValue"); - assert((client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - 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('node', () => { - const fakePath = "/rendered/path/node"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - node: "nodeValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.nodePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodePath', () => { - const result = client.nodePath("projectValue", "locationValue", "nodeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeName', () => { - const result = client.matchProjectFromNodeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeName', () => { - const result = client.matchLocationFromNodeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeFromNodeName', () => { - const result = client.matchNodeFromNodeName(fakePath); - assert.strictEqual(result, "nodeValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - 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('queuedResource', () => { - const fakePath = "/rendered/path/queuedResource"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - queued_resource: "queuedResourceValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.queuedResourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.queuedResourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('queuedResourcePath', () => { - const result = client.queuedResourcePath("projectValue", "locationValue", "queuedResourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.queuedResourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromQueuedResourceName', () => { - const result = client.matchProjectFromQueuedResourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromQueuedResourceName', () => { - const result = client.matchLocationFromQueuedResourceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchQueuedResourceFromQueuedResourceName', () => { - const result = client.matchQueuedResourceFromQueuedResourceName(fakePath); - assert.strictEqual(result, "queuedResourceValue"); - assert((client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('runtimeVersion', () => { - const fakePath = "/rendered/path/runtimeVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - runtime_version: "runtimeVersionValue", - }; - const client = new tpuModule.v2alpha1.TpuClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.runtimeVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.runtimeVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('runtimeVersionPath', () => { - const result = client.runtimeVersionPath("projectValue", "locationValue", "runtimeVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRuntimeVersionName', () => { - const result = client.matchProjectFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRuntimeVersionName', () => { - const result = client.matchLocationFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuntimeVersionFromRuntimeVersionName', () => { - const result = client.matchRuntimeVersionFromRuntimeVersionName(fakePath); - assert.strictEqual(result, "runtimeVersionValue"); - assert((client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json b/owl-bot-staging/google-cloud-tpu/v2alpha1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/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-cloud-tpu/v2alpha1/webpack.config.js b/owl-bot-staging/google-cloud-tpu/v2alpha1/webpack.config.js deleted file mode 100644 index 8ee514d072f..00000000000 --- a/owl-bot-staging/google-cloud-tpu/v2alpha1/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: 'Tpu', - filename: './tpu.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-cloud-tpu/README.md b/packages/google-cloud-tpu/README.md index 8e85d28bf8e..ee2dfb3fde9 100644 --- a/packages/google-cloud-tpu/README.md +++ b/packages/google-cloud-tpu/README.md @@ -98,16 +98,34 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Tpu.reimage_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v1/tpu.reimage_node.js,samples/README.md) | | Tpu.start_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v1/tpu.start_node.js,samples/README.md) | | Tpu.stop_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v1/tpu.stop_node.js,samples/README.md) | +| Tpu.create_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js,samples/README.md) | +| Tpu.delete_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js,samples/README.md) | +| Tpu.generate_service_identity | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js,samples/README.md) | +| Tpu.get_accelerator_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js,samples/README.md) | +| Tpu.get_guest_attributes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js,samples/README.md) | +| Tpu.get_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js,samples/README.md) | +| Tpu.get_runtime_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js,samples/README.md) | +| Tpu.list_accelerator_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js,samples/README.md) | +| Tpu.list_nodes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js,samples/README.md) | +| Tpu.list_runtime_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js,samples/README.md) | +| Tpu.start_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js,samples/README.md) | +| Tpu.stop_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js,samples/README.md) | +| Tpu.update_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js,samples/README.md) | | Tpu.create_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js,samples/README.md) | +| Tpu.create_queued_resource | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js,samples/README.md) | | Tpu.delete_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js,samples/README.md) | +| Tpu.delete_queued_resource | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js,samples/README.md) | | Tpu.generate_service_identity | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js,samples/README.md) | | Tpu.get_accelerator_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_accelerator_type.js,samples/README.md) | | Tpu.get_guest_attributes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_guest_attributes.js,samples/README.md) | | Tpu.get_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_node.js,samples/README.md) | +| Tpu.get_queued_resource | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js,samples/README.md) | | Tpu.get_runtime_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js,samples/README.md) | | Tpu.list_accelerator_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_accelerator_types.js,samples/README.md) | | Tpu.list_nodes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_nodes.js,samples/README.md) | +| Tpu.list_queued_resources | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js,samples/README.md) | | Tpu.list_runtime_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js,samples/README.md) | +| Tpu.simulate_maintenance_event | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js,samples/README.md) | | Tpu.start_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js,samples/README.md) | | Tpu.stop_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js,samples/README.md) | | Tpu.update_node | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js,samples/README.md) | diff --git a/owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2/cloud_tpu.proto similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/protos/google/cloud/tpu/v2/cloud_tpu.proto rename to packages/google-cloud-tpu/protos/google/cloud/tpu/v2/cloud_tpu.proto diff --git a/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto index 612e1c4f5dd..b6f0623b787 100644 --- a/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto +++ b/packages/google-cloud-tpu/protos/google/cloud/tpu/v2alpha1/cloud_tpu.proto @@ -21,8 +21,11 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/interval.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu"; option java_multiple_files = true; @@ -34,8 +37,7 @@ option java_package = "com.google.cloud.tpu.v2alpha1"; // TPU API v2alpha1 service Tpu { option (google.api.default_host) = "tpu.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Lists nodes. rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) { @@ -73,7 +75,7 @@ service Tpu { }; option (google.api.method_signature) = "name"; option (google.longrunning.operation_info) = { - response_type: "Node" + response_type: "google.protobuf.Empty" metadata_type: "OperationMetadata" }; } @@ -115,9 +117,49 @@ service Tpu { }; } + // Lists queued resources. + rpc ListQueuedResources(ListQueuedResourcesRequest) returns (ListQueuedResourcesResponse) { + option (google.api.http) = { + get: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a queued resource. + rpc GetQueuedResource(GetQueuedResourceRequest) returns (QueuedResource) { + option (google.api.http) = { + get: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a QueuedResource TPU instance. + rpc CreateQueuedResource(CreateQueuedResourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" + body: "queued_resource" + }; + option (google.api.method_signature) = "parent,queued_resource,queued_resource_id"; + option (google.longrunning.operation_info) = { + response_type: "QueuedResource" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a QueuedResource TPU instance. + rpc DeleteQueuedResource(DeleteQueuedResourceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "QueuedResource" + metadata_type: "OperationMetadata" + }; + } + // Generates the Cloud TPU service identity for the project. - rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) - returns (GenerateServiceIdentityResponse) { + rpc GenerateServiceIdentity(GenerateServiceIdentityRequest) returns (GenerateServiceIdentityResponse) { option (google.api.http) = { post: "/v2alpha1/{parent=projects/*/locations/*}:generateServiceIdentity" body: "*" @@ -125,8 +167,7 @@ service Tpu { } // Lists accelerator types supported by this API. - rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) - returns (ListAcceleratorTypesResponse) { + rpc ListAcceleratorTypes(ListAcceleratorTypesRequest) returns (ListAcceleratorTypesResponse) { option (google.api.http) = { get: "/v2alpha1/{parent=projects/*/locations/*}/acceleratorTypes" }; @@ -142,8 +183,7 @@ service Tpu { } // Lists runtime versions supported by this API. - rpc ListRuntimeVersions(ListRuntimeVersionsRequest) - returns (ListRuntimeVersionsResponse) { + rpc ListRuntimeVersions(ListRuntimeVersionsRequest) returns (ListRuntimeVersionsResponse) { option (google.api.http) = { get: "/v2alpha1/{parent=projects/*/locations/*}/runtimeVersions" }; @@ -159,13 +199,24 @@ service Tpu { } // Retrieves the guest attributes for the node. - rpc GetGuestAttributes(GetGuestAttributesRequest) - returns (GetGuestAttributesResponse) { + rpc GetGuestAttributes(GetGuestAttributesRequest) returns (GetGuestAttributesResponse) { option (google.api.http) = { post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:getGuestAttributes" body: "*" }; } + + // Simulates a maintenance event. + rpc SimulateMaintenanceEvent(SimulateMaintenanceEventRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Node" + metadata_type: "OperationMetadata" + }; + } } // A guest attributes. @@ -266,6 +317,11 @@ message NetworkConfig { // workers. If set to false, the specified subnetwork or network should have // Private Google Access enabled. bool enable_external_ips = 3; + + // Allows the TPU node to send and receive packets with non-matching + // destination or source IPs. This is required if you plan to use the TPU + // workers to forward routes. + bool can_ip_forward = 4; } // A service account. @@ -307,7 +363,7 @@ message Node { DELETING = 5; // TPU node is being repaired and may be unusable. Details can be - // found in the `help_description` field. + // found in the 'help_description' field. REPAIRING = 6; // TPU node is stopped. @@ -380,14 +436,14 @@ message Node { // The user-supplied description of the TPU. Maximum of 512 characters. string description = 3; - // Required. The type of hardware accelerators associated with this node. - string accelerator_type = 5 [(google.api.field_behavior) = REQUIRED]; + // The type of hardware accelerators associated with this node. + string accelerator_type = 5; // Output only. The current state for the TPU Node. State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. If this field is populated, it contains a description of why - // the TPU Node is unhealthy. + // Output only. If this field is populated, it contains a description of why the TPU Node + // is unhealthy. string health_description = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; // Required. The runtime version running in the Node. @@ -411,8 +467,7 @@ message Node { ServiceAccount service_account = 37; // Output only. The time when the node was created. - google.protobuf.Timestamp create_time = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; // The scheduling options for this node. SchedulingConfig scheduling_config = 17; @@ -420,8 +475,7 @@ message Node { // Output only. The network endpoints where TPU workers can be accessed and // sent work. It is recommended that runtime clients of the node reach out // to the 0th entry in this map first. - repeated NetworkEndpoint network_endpoints = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated NetworkEndpoint network_endpoints = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; // The health status of the TPU node. Health health = 22; @@ -449,16 +503,241 @@ message Node { // Output only. The Symptoms that have occurred to the TPU Node. repeated Symptom symptoms = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The qualified name of the QueuedResource that requested this Node. + string queued_resource = 43 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Shielded Instance options. ShieldedInstanceConfig shielded_instance_config = 45; } +// A QueuedResource represents a request for resources that will be placed +// in a queue and fulfilled when the necessary resources are available. +message QueuedResource { + option (google.api.resource) = { + type: "tpu.googleapis.com/QueuedResource" + pattern: "projects/{project}/locations/{location}/queuedResources/{queued_resource}" + }; + + // Details of the TPU resource(s) being requested. + message Tpu { + // Details of the TPU node(s) being requested. Users can request either a + // single node or multiple nodes. + // NodeSpec provides the specification for node(s) to be created. + message NodeSpec { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + // regex format. This is only specified when requesting a single node. + // In case of multi-node requests, multi_node_params must be populated + // instead. It's an error to specify both node_id and multi_node_params. + string node_id = 2; + + // Required. The node. + Node node = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // The TPU node(s) being requested. + repeated NodeSpec node_spec = 1; + } + + // BestEffort tier definition. + message BestEffort { + + } + + // Guaranteed tier definition. + message Guaranteed { + // Optional. Defines the minimum duration of the guarantee. If specified, + // the requested resources will only be provisioned if they can be + // allocated for at least the given duration. + google.protobuf.Duration min_duration = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the request should be scheduled on reserved capacity. + bool reserved = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Defines the policy of the QueuedRequest. + message QueueingPolicy { + // Time flexibility specification. + oneof start_timing_constraints { + // A relative time after which resources should not be created. + // If the request cannot be fulfilled by this time the request will be + // failed. + google.protobuf.Duration valid_until_duration = 1; + + // An absolute time after which resources should not be created. + // If the request cannot be fulfilled by this time the request will be + // failed. + google.protobuf.Timestamp valid_until_time = 2; + + // A relative time after which resources may be created. + google.protobuf.Duration valid_after_duration = 3; + + // An absolute time at which resources may be created. + google.protobuf.Timestamp valid_after_time = 4; + + // An absolute time interval within which resources may be created. + google.type.Interval valid_interval = 5; + } + } + + // Output only. Immutable. The name of the QueuedResource. + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Resource specification. + oneof resource { + // Defines a TPU resource. + Tpu tpu = 2; + } + + // Tier specifies the required tier. + oneof tier { + // The BestEffort tier. + BestEffort best_effort = 3; + + // The Guaranteed tier + Guaranteed guaranteed = 4; + } + + // The queueing policy of the QueuedRequest. + QueueingPolicy queueing_policy = 5; + + // Output only. State of the QueuedResource request + QueuedResourceState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// QueuedResourceState defines the details of the QueuedResource request. +message QueuedResourceState { + // Output only state of the request + enum State { + // State of the QueuedResource request is not known/set. + STATE_UNSPECIFIED = 0; + + // The QueuedResource request has been received. We're still working on + // determining if we will be able to honor this request. + CREATING = 1; + + // The QueuedResource request has passed initial validation/admission + // control and has been persisted in the queue. + ACCEPTED = 2; + + // The QueuedResource request has been selected. The + // associated resources are currently being provisioned (or very soon + // will begin provisioning). + PROVISIONING = 3; + + // The request could not be completed. This may be due to some + // late-discovered problem with the request itself, or due to + // unavailability of resources within the constraints of the request + // (e.g., the 'valid until' start timing constraint expired). + FAILED = 4; + + // The QueuedResource is being deleted. + DELETING = 5; + + // The resources specified in the QueuedResource request have been + // provisioned and are ready for use by the end-user/consumer. + ACTIVE = 6; + + // The resources specified in the QueuedResource request are being + // deleted. This may have been initiated by the user, or + // the Cloud TPU service. Inspect the state data for more details. + SUSPENDING = 7; + + // The resources specified in the QueuedResource request have been + // deleted. + SUSPENDED = 8; + } + + // Further data for the creating state. + message CreatingData { + + } + + // Further data for the accepted state. + message AcceptedData { + + } + + // Further data for the provisioning state. + message ProvisioningData { + + } + + // Further data for the failed state. + message FailedData { + // The error that caused the queued resource to enter the FAILED state. + google.rpc.Status error = 1; + } + + // Further data for the deleting state. + message DeletingData { + + } + + // Further data for the active state. + message ActiveData { + + } + + // Further data for the suspending state. + message SuspendingData { + + } + + // Further data for the suspended state. + message SuspendedData { + + } + + // State of the QueuedResource request. + State state = 1; + + // Further data for the state. + oneof state_data { + // Further data for the creating state. + CreatingData creating_data = 2; + + // Further data for the accepted state. + AcceptedData accepted_data = 3; + + // Further data for the provisioning state. + ProvisioningData provisioning_data = 4; + + // Further data for the failed state. + FailedData failed_data = 5; + + // Further data for the deleting state. + DeletingData deleting_data = 6; + + // Further data for the active state. + ActiveData active_data = 7; + + // Further data for the suspending state. + SuspendingData suspending_data = 8; + + // Further data for the suspended state. + SuspendedData suspended_data = 9; + } +} + // Request for [ListNodes][google.cloud.tpu.v2alpha1.Tpu.ListNodes]. message ListNodesRequest { // Required. The parent resource name. string parent = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/Node" + } ]; // The maximum number of items to return. @@ -485,7 +764,9 @@ message GetNodeRequest { // Required. The resource name. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } ]; } @@ -504,6 +785,9 @@ message CreateNodeRequest { // Required. The node. Node node = 3 [(google.api.field_behavior) = REQUIRED]; + + // Idempotent request UUID. + string request_id = 6; } // Request for [DeleteNode][google.cloud.tpu.v2alpha1.Tpu.DeleteNode]. @@ -511,41 +795,130 @@ message DeleteNodeRequest { // Required. The resource name. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } ]; + + // Idempotent request UUID. + string request_id = 3; } // Request for [StopNode][google.cloud.tpu.v2alpha1.Tpu.StopNode]. message StopNodeRequest { - // The resource name. - string name = 1; + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; } // Request for [StartNode][google.cloud.tpu.v2alpha1.Tpu.StartNode]. message StartNodeRequest { - // The resource name. - string name = 1; + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; } // Request for [UpdateNode][google.cloud.tpu.v2alpha1.Tpu.UpdateNode]. message UpdateNodeRequest { // Required. Mask of fields from [Node][Tpu.Node] to update. - // Supported fields: None. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; + // Supported fields: [description, tags, labels, metadata, + // network_config.enable_external_ips]. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The node. Only fields specified in update_mask are updated. Node node = 2 [(google.api.field_behavior) = REQUIRED]; } +// Request for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. +message ListQueuedResourcesRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "tpu.googleapis.com/QueuedResource" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 3; +} + +// Response for [ListQueuedResources][google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources]. +message ListQueuedResourcesResponse { + // The listed queued resources. + repeated QueuedResource queued_resources = 1; + + // The next page token or empty if none. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [GetQueuedResource][google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource] +message GetQueuedResourceRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/QueuedResource" + } + ]; +} + +// Request for [CreateQueuedResource][google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource]. +message CreateQueuedResourceRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + // regex format. + string queued_resource_id = 2; + + // Required. The queued resource. + QueuedResource queued_resource = 3 [(google.api.field_behavior) = REQUIRED]; + + // Idempotent request UUID. + string request_id = 4; +} + +// Request for [DeleteQueuedResource][google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource]. +message DeleteQueuedResourceRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/QueuedResource" + } + ]; + + // Idempotent request UUID. + string request_id = 2; +} + // The per-product per-project service identity for Cloud TPU service. message ServiceIdentity { // The email address of the service identity. string email = 1; } -// Request for -// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +// Request for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. message GenerateServiceIdentityRequest { // Required. The parent resource name. string parent = 1 [ @@ -556,8 +929,7 @@ message GenerateServiceIdentityRequest { ]; } -// Response for -// [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. +// Response for [GenerateServiceIdentity][google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentity]. message GenerateServiceIdentityResponse { // ServiceIdentity that was created or retrieved. ServiceIdentity identity = 1; @@ -573,12 +945,11 @@ message AcceleratorType { // The resource name. string name = 1; - // the accelerator type. + // The accelerator type. string type = 2; } -// Request for -// [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType]. +// Request for [GetAcceleratorType][google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorType]. message GetAcceleratorTypeRequest { // Required. The resource name. string name = 1 [ @@ -589,14 +960,13 @@ message GetAcceleratorTypeRequest { ]; } -// Request for -// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +// Request for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. message ListAcceleratorTypesRequest { // Required. The parent resource name. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "tpu.googleapis.com/AcceleratorType" + child_type: "tpu.googleapis.com/AcceleratorType" } ]; @@ -613,8 +983,7 @@ message ListAcceleratorTypesRequest { string order_by = 6; } -// Response for -// [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. +// Response for [ListAcceleratorTypes][google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypes]. message ListAcceleratorTypesResponse { // The listed nodes. repeated AcceleratorType accelerator_types = 1; @@ -626,36 +995,6 @@ message ListAcceleratorTypesResponse { repeated string unreachable = 3; } -// Note: the following OperationMetadata message was added manually. -// This is caused by a conflict with some other message and will -// be resolved separately. Please make sure to add this message back -// if it's removed during public proto regeneration. - -// Metadata describing an [Operation][google.longrunning.Operation] -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Target of the operation - for example - // projects/project-1/connectivityTests/test-1 - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_detail = 5; - - // Specifies if cancellation was requested for the operation. - bool cancel_requested = 6; - - // API version. - string api_version = 7; -} - // A runtime version that a Node can be configured with. message RuntimeVersion { option (google.api.resource) = { @@ -670,8 +1009,7 @@ message RuntimeVersion { string version = 2; } -// Request for -// [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion]. +// Request for [GetRuntimeVersion][google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersion]. message GetRuntimeVersionRequest { // Required. The resource name. string name = 1 [ @@ -682,14 +1020,13 @@ message GetRuntimeVersionRequest { ]; } -// Request for -// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +// Request for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. message ListRuntimeVersionsRequest { // Required. The parent resource name. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "tpu.googleapis.com/RuntimeVersion" + child_type: "tpu.googleapis.com/RuntimeVersion" } ]; @@ -706,8 +1043,7 @@ message ListRuntimeVersionsRequest { string order_by = 6; } -// Response for -// [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. +// Response for [ListRuntimeVersions][google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersions]. message ListRuntimeVersionsResponse { // The listed nodes. repeated RuntimeVersion runtime_versions = 1; @@ -719,6 +1055,31 @@ message ListRuntimeVersionsResponse { repeated string unreachable = 3; } +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Target of the operation - for example + // projects/project-1/connectivityTests/test-1 + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Specifies if cancellation was requested for the operation. + bool cancel_requested = 6; + + // API version. + string api_version = 7; +} + // A Symptom instance. message Symptom { // SymptomType represents the different types of Symptoms that a TPU can be @@ -760,13 +1121,14 @@ message Symptom { string worker_id = 4; } -// Request for -// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +// Request for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. message GetGuestAttributesRequest { // Required. The resource name. string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "tpu.googleapis.com/Node" } + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } ]; // The guest attributes path to be queried. @@ -777,15 +1139,31 @@ message GetGuestAttributesRequest { repeated string worker_ids = 3; } -// Response for -// [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. +// Response for [GetGuestAttributes][google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributes]. message GetGuestAttributesResponse { // The guest attributes for the TPU workers. repeated GuestAttributes guest_attributes = 1; } +// Request for [SimulateMaintenanceEvent][google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent]. +message SimulateMaintenanceEventRequest { + // Required. The resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "tpu.googleapis.com/Node" + } + ]; + + // The 0-based worker ID. If it is empty, worker ID 0 will be selected for + // maintenance event simulation. A maintenance event will only be fired on the + // first specified worker ID. Future implementations may support firing on + // multiple workers. + repeated string worker_ids = 2; +} + // A set of Shielded Instance options. message ShieldedInstanceConfig { // Defines whether the instance has Secure Boot enabled. bool enable_secure_boot = 1; -} \ No newline at end of file +} diff --git a/packages/google-cloud-tpu/protos/protos.d.ts b/packages/google-cloud-tpu/protos/protos.d.ts index c84e1e38650..dbc4220a08d 100644 --- a/packages/google-cloud-tpu/protos/protos.d.ts +++ b/packages/google-cloud-tpu/protos/protos.d.ts @@ -2673,8 +2673,8 @@ export namespace google { } } - /** Namespace v2alpha1. */ - namespace v2alpha1 { + /** Namespace v2. */ + namespace v2 { /** Represents a Tpu */ class Tpu extends $protobuf.rpc.Service { @@ -2701,276 +2701,276 @@ export namespace google { * @param request ListNodesRequest message or plain object * @param callback Node-style callback called with the error, if any, and ListNodesResponse */ - public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback): void; + public listNodes(request: google.cloud.tpu.v2.IListNodesRequest, callback: google.cloud.tpu.v2.Tpu.ListNodesCallback): void; /** * Calls ListNodes. * @param request ListNodesRequest message or plain object * @returns Promise */ - public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest): Promise; + public listNodes(request: google.cloud.tpu.v2.IListNodesRequest): Promise; /** * Calls GetNode. * @param request GetNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Node */ - public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback): void; + public getNode(request: google.cloud.tpu.v2.IGetNodeRequest, callback: google.cloud.tpu.v2.Tpu.GetNodeCallback): void; /** * Calls GetNode. * @param request GetNodeRequest message or plain object * @returns Promise */ - public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest): Promise; + public getNode(request: google.cloud.tpu.v2.IGetNodeRequest): Promise; /** * Calls CreateNode. * @param request CreateNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Operation */ - public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback): void; + public createNode(request: google.cloud.tpu.v2.ICreateNodeRequest, callback: google.cloud.tpu.v2.Tpu.CreateNodeCallback): void; /** * Calls CreateNode. * @param request CreateNodeRequest message or plain object * @returns Promise */ - public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest): Promise; + public createNode(request: google.cloud.tpu.v2.ICreateNodeRequest): Promise; /** * Calls DeleteNode. * @param request DeleteNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Operation */ - public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback): void; + public deleteNode(request: google.cloud.tpu.v2.IDeleteNodeRequest, callback: google.cloud.tpu.v2.Tpu.DeleteNodeCallback): void; /** * Calls DeleteNode. * @param request DeleteNodeRequest message or plain object * @returns Promise */ - public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): Promise; + public deleteNode(request: google.cloud.tpu.v2.IDeleteNodeRequest): Promise; /** * Calls StopNode. * @param request StopNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Operation */ - public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback): void; + public stopNode(request: google.cloud.tpu.v2.IStopNodeRequest, callback: google.cloud.tpu.v2.Tpu.StopNodeCallback): void; /** * Calls StopNode. * @param request StopNodeRequest message or plain object * @returns Promise */ - public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest): Promise; + public stopNode(request: google.cloud.tpu.v2.IStopNodeRequest): Promise; /** * Calls StartNode. * @param request StartNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Operation */ - public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback): void; + public startNode(request: google.cloud.tpu.v2.IStartNodeRequest, callback: google.cloud.tpu.v2.Tpu.StartNodeCallback): void; /** * Calls StartNode. * @param request StartNodeRequest message or plain object * @returns Promise */ - public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest): Promise; + public startNode(request: google.cloud.tpu.v2.IStartNodeRequest): Promise; /** * Calls UpdateNode. * @param request UpdateNodeRequest message or plain object * @param callback Node-style callback called with the error, if any, and Operation */ - public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback): void; + public updateNode(request: google.cloud.tpu.v2.IUpdateNodeRequest, callback: google.cloud.tpu.v2.Tpu.UpdateNodeCallback): void; /** * Calls UpdateNode. * @param request UpdateNodeRequest message or plain object * @returns Promise */ - public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): Promise; + public updateNode(request: google.cloud.tpu.v2.IUpdateNodeRequest): Promise; /** * Calls GenerateServiceIdentity. * @param request GenerateServiceIdentityRequest message or plain object * @param callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse */ - public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback): void; + public generateServiceIdentity(request: google.cloud.tpu.v2.IGenerateServiceIdentityRequest, callback: google.cloud.tpu.v2.Tpu.GenerateServiceIdentityCallback): void; /** * Calls GenerateServiceIdentity. * @param request GenerateServiceIdentityRequest message or plain object * @returns Promise */ - public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest): Promise; + public generateServiceIdentity(request: google.cloud.tpu.v2.IGenerateServiceIdentityRequest): Promise; /** * Calls ListAcceleratorTypes. * @param request ListAcceleratorTypesRequest message or plain object * @param callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse */ - public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback): void; + public listAcceleratorTypes(request: google.cloud.tpu.v2.IListAcceleratorTypesRequest, callback: google.cloud.tpu.v2.Tpu.ListAcceleratorTypesCallback): void; /** * Calls ListAcceleratorTypes. * @param request ListAcceleratorTypesRequest message or plain object * @returns Promise */ - public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest): Promise; + public listAcceleratorTypes(request: google.cloud.tpu.v2.IListAcceleratorTypesRequest): Promise; /** * Calls GetAcceleratorType. * @param request GetAcceleratorTypeRequest message or plain object * @param callback Node-style callback called with the error, if any, and AcceleratorType */ - public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback): void; + public getAcceleratorType(request: google.cloud.tpu.v2.IGetAcceleratorTypeRequest, callback: google.cloud.tpu.v2.Tpu.GetAcceleratorTypeCallback): void; /** * Calls GetAcceleratorType. * @param request GetAcceleratorTypeRequest message or plain object * @returns Promise */ - public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest): Promise; + public getAcceleratorType(request: google.cloud.tpu.v2.IGetAcceleratorTypeRequest): Promise; /** * Calls ListRuntimeVersions. * @param request ListRuntimeVersionsRequest message or plain object * @param callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse */ - public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback): void; + public listRuntimeVersions(request: google.cloud.tpu.v2.IListRuntimeVersionsRequest, callback: google.cloud.tpu.v2.Tpu.ListRuntimeVersionsCallback): void; /** * Calls ListRuntimeVersions. * @param request ListRuntimeVersionsRequest message or plain object * @returns Promise */ - public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest): Promise; + public listRuntimeVersions(request: google.cloud.tpu.v2.IListRuntimeVersionsRequest): Promise; /** * Calls GetRuntimeVersion. * @param request GetRuntimeVersionRequest message or plain object * @param callback Node-style callback called with the error, if any, and RuntimeVersion */ - public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback): void; + public getRuntimeVersion(request: google.cloud.tpu.v2.IGetRuntimeVersionRequest, callback: google.cloud.tpu.v2.Tpu.GetRuntimeVersionCallback): void; /** * Calls GetRuntimeVersion. * @param request GetRuntimeVersionRequest message or plain object * @returns Promise */ - public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest): Promise; + public getRuntimeVersion(request: google.cloud.tpu.v2.IGetRuntimeVersionRequest): Promise; /** * Calls GetGuestAttributes. * @param request GetGuestAttributesRequest message or plain object * @param callback Node-style callback called with the error, if any, and GetGuestAttributesResponse */ - public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback): void; + public getGuestAttributes(request: google.cloud.tpu.v2.IGetGuestAttributesRequest, callback: google.cloud.tpu.v2.Tpu.GetGuestAttributesCallback): void; /** * Calls GetGuestAttributes. * @param request GetGuestAttributesRequest message or plain object * @returns Promise */ - public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest): Promise; + public getGuestAttributes(request: google.cloud.tpu.v2.IGetGuestAttributesRequest): Promise; } namespace Tpu { /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listNodes}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listNodes}. * @param error Error, if any * @param [response] ListNodesResponse */ - type ListNodesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListNodesResponse) => void; + type ListNodesCallback = (error: (Error|null), response?: google.cloud.tpu.v2.ListNodesResponse) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getNode}. * @param error Error, if any * @param [response] Node */ - type GetNodeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.Node) => void; + type GetNodeCallback = (error: (Error|null), response?: google.cloud.tpu.v2.Node) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|createNode}. * @param error Error, if any * @param [response] Operation */ type CreateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|deleteNode}. * @param error Error, if any * @param [response] Operation */ type DeleteNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|stopNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|stopNode}. * @param error Error, if any * @param [response] Operation */ type StopNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|startNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|startNode}. * @param error Error, if any * @param [response] Operation */ type StartNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|updateNode}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|updateNode}. * @param error Error, if any * @param [response] Operation */ type UpdateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|generateServiceIdentity}. * @param error Error, if any * @param [response] GenerateServiceIdentityResponse */ - type GenerateServiceIdentityCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) => void; + type GenerateServiceIdentityCallback = (error: (Error|null), response?: google.cloud.tpu.v2.GenerateServiceIdentityResponse) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listAcceleratorTypes}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listAcceleratorTypes}. * @param error Error, if any * @param [response] ListAcceleratorTypesResponse */ - type ListAcceleratorTypesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) => void; + type ListAcceleratorTypesCallback = (error: (Error|null), response?: google.cloud.tpu.v2.ListAcceleratorTypesResponse) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getAcceleratorType}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getAcceleratorType}. * @param error Error, if any * @param [response] AcceleratorType */ - type GetAcceleratorTypeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.AcceleratorType) => void; + type GetAcceleratorTypeCallback = (error: (Error|null), response?: google.cloud.tpu.v2.AcceleratorType) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listRuntimeVersions}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listRuntimeVersions}. * @param error Error, if any * @param [response] ListRuntimeVersionsResponse */ - type ListRuntimeVersionsCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) => void; + type ListRuntimeVersionsCallback = (error: (Error|null), response?: google.cloud.tpu.v2.ListRuntimeVersionsResponse) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getRuntimeVersion}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getRuntimeVersion}. * @param error Error, if any * @param [response] RuntimeVersion */ - type GetRuntimeVersionCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.RuntimeVersion) => void; + type GetRuntimeVersionCallback = (error: (Error|null), response?: google.cloud.tpu.v2.RuntimeVersion) => void; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getGuestAttributes}. + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getGuestAttributes}. * @param error Error, if any * @param [response] GetGuestAttributesResponse */ - type GetGuestAttributesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) => void; + type GetGuestAttributesCallback = (error: (Error|null), response?: google.cloud.tpu.v2.GetGuestAttributesResponse) => void; } /** Properties of a GuestAttributes. */ @@ -2980,7 +2980,7 @@ export namespace google { queryPath?: (string|null); /** GuestAttributes queryValue */ - queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + queryValue?: (google.cloud.tpu.v2.IGuestAttributesValue|null); } /** Represents a GuestAttributes. */ @@ -2990,36 +2990,36 @@ export namespace google { * Constructs a new GuestAttributes. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes); + constructor(properties?: google.cloud.tpu.v2.IGuestAttributes); /** GuestAttributes queryPath. */ public queryPath: string; /** GuestAttributes queryValue. */ - public queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + public queryValue?: (google.cloud.tpu.v2.IGuestAttributesValue|null); /** * Creates a new GuestAttributes instance using the specified properties. * @param [properties] Properties to set * @returns GuestAttributes instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes): google.cloud.tpu.v2alpha1.GuestAttributes; + public static create(properties?: google.cloud.tpu.v2.IGuestAttributes): google.cloud.tpu.v2.GuestAttributes; /** - * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributes.verify|verify} messages. * @param message GuestAttributes message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributes.verify|verify} messages. * @param message GuestAttributes message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a GuestAttributes message from the specified reader or buffer. @@ -3029,7 +3029,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributes; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.GuestAttributes; /** * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. @@ -3038,7 +3038,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributes; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.GuestAttributes; /** * Verifies a GuestAttributes message. @@ -3052,7 +3052,7 @@ export namespace google { * @param object Plain object * @returns GuestAttributes */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributes; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GuestAttributes; /** * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. @@ -3060,7 +3060,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributes, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.GuestAttributes, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this GuestAttributes to JSON. @@ -3080,7 +3080,7 @@ export namespace google { interface IGuestAttributesValue { /** GuestAttributesValue items */ - items?: (google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]|null); + items?: (google.cloud.tpu.v2.IGuestAttributesEntry[]|null); } /** Represents a GuestAttributesValue. */ @@ -3090,33 +3090,33 @@ export namespace google { * Constructs a new GuestAttributesValue. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue); + constructor(properties?: google.cloud.tpu.v2.IGuestAttributesValue); /** GuestAttributesValue items. */ - public items: google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]; + public items: google.cloud.tpu.v2.IGuestAttributesEntry[]; /** * Creates a new GuestAttributesValue instance using the specified properties. * @param [properties] Properties to set * @returns GuestAttributesValue instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue): google.cloud.tpu.v2alpha1.GuestAttributesValue; + public static create(properties?: google.cloud.tpu.v2.IGuestAttributesValue): google.cloud.tpu.v2.GuestAttributesValue; /** - * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesValue.verify|verify} messages. * @param message GuestAttributesValue message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesValue.verify|verify} messages. * @param message GuestAttributesValue message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a GuestAttributesValue message from the specified reader or buffer. @@ -3126,7 +3126,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.GuestAttributesValue; /** * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. @@ -3135,7 +3135,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.GuestAttributesValue; /** * Verifies a GuestAttributesValue message. @@ -3149,7 +3149,7 @@ export namespace google { * @param object Plain object * @returns GuestAttributesValue */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesValue; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GuestAttributesValue; /** * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. @@ -3157,7 +3157,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.GuestAttributesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this GuestAttributesValue to JSON. @@ -3193,7 +3193,7 @@ export namespace google { * Constructs a new GuestAttributesEntry. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry); + constructor(properties?: google.cloud.tpu.v2.IGuestAttributesEntry); /** GuestAttributesEntry namespace. */ public namespace: string; @@ -3209,23 +3209,23 @@ export namespace google { * @param [properties] Properties to set * @returns GuestAttributesEntry instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + public static create(properties?: google.cloud.tpu.v2.IGuestAttributesEntry): google.cloud.tpu.v2.GuestAttributesEntry; /** - * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesEntry.verify|verify} messages. * @param message GuestAttributesEntry message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesEntry.verify|verify} messages. * @param message GuestAttributesEntry message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a GuestAttributesEntry message from the specified reader or buffer. @@ -3235,7 +3235,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.GuestAttributesEntry; /** * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. @@ -3244,7 +3244,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.GuestAttributesEntry; /** * Verifies a GuestAttributesEntry message. @@ -3258,7 +3258,7 @@ export namespace google { * @param object Plain object * @returns GuestAttributesEntry */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GuestAttributesEntry; /** * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. @@ -3266,7 +3266,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.GuestAttributesEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this GuestAttributesEntry to JSON. @@ -3289,7 +3289,7 @@ export namespace google { sourceDisk?: (string|null); /** AttachedDisk mode */ - mode?: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null); + mode?: (google.cloud.tpu.v2.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2.AttachedDisk.DiskMode|null); } /** Represents an AttachedDisk. */ @@ -3299,36 +3299,36 @@ export namespace google { * Constructs a new AttachedDisk. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk); + constructor(properties?: google.cloud.tpu.v2.IAttachedDisk); /** AttachedDisk sourceDisk. */ public sourceDisk: string; /** AttachedDisk mode. */ - public mode: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode); + public mode: (google.cloud.tpu.v2.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2.AttachedDisk.DiskMode); /** * Creates a new AttachedDisk instance using the specified properties. * @param [properties] Properties to set * @returns AttachedDisk instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk): google.cloud.tpu.v2alpha1.AttachedDisk; + public static create(properties?: google.cloud.tpu.v2.IAttachedDisk): google.cloud.tpu.v2.AttachedDisk; /** - * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2.AttachedDisk.verify|verify} messages. * @param message AttachedDisk message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AttachedDisk.verify|verify} messages. * @param message AttachedDisk message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes an AttachedDisk message from the specified reader or buffer. @@ -3338,7 +3338,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.AttachedDisk; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.AttachedDisk; /** * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. @@ -3347,7 +3347,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.AttachedDisk; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.AttachedDisk; /** * Verifies an AttachedDisk message. @@ -3361,7 +3361,7 @@ export namespace google { * @param object Plain object * @returns AttachedDisk */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AttachedDisk; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.AttachedDisk; /** * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. @@ -3369,7 +3369,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.AttachedDisk, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.AttachedDisk, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this AttachedDisk to JSON. @@ -3412,7 +3412,7 @@ export namespace google { * Constructs a new SchedulingConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig); + constructor(properties?: google.cloud.tpu.v2.ISchedulingConfig); /** SchedulingConfig preemptible. */ public preemptible: boolean; @@ -3425,23 +3425,23 @@ export namespace google { * @param [properties] Properties to set * @returns SchedulingConfig instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig): google.cloud.tpu.v2alpha1.SchedulingConfig; + public static create(properties?: google.cloud.tpu.v2.ISchedulingConfig): google.cloud.tpu.v2.SchedulingConfig; /** - * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2.SchedulingConfig.verify|verify} messages. * @param message SchedulingConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.SchedulingConfig.verify|verify} messages. * @param message SchedulingConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a SchedulingConfig message from the specified reader or buffer. @@ -3451,7 +3451,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.SchedulingConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.SchedulingConfig; /** * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. @@ -3460,7 +3460,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.SchedulingConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.SchedulingConfig; /** * Verifies a SchedulingConfig message. @@ -3474,7 +3474,7 @@ export namespace google { * @param object Plain object * @returns SchedulingConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.SchedulingConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.SchedulingConfig; /** * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. @@ -3482,7 +3482,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.SchedulingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.SchedulingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this SchedulingConfig to JSON. @@ -3508,7 +3508,7 @@ export namespace google { port?: (number|null); /** NetworkEndpoint accessConfig */ - accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + accessConfig?: (google.cloud.tpu.v2.IAccessConfig|null); } /** Represents a NetworkEndpoint. */ @@ -3518,7 +3518,7 @@ export namespace google { * Constructs a new NetworkEndpoint. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint); + constructor(properties?: google.cloud.tpu.v2.INetworkEndpoint); /** NetworkEndpoint ipAddress. */ public ipAddress: string; @@ -3527,30 +3527,30 @@ export namespace google { public port: number; /** NetworkEndpoint accessConfig. */ - public accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + public accessConfig?: (google.cloud.tpu.v2.IAccessConfig|null); /** * Creates a new NetworkEndpoint instance using the specified properties. * @param [properties] Properties to set * @returns NetworkEndpoint instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint): google.cloud.tpu.v2alpha1.NetworkEndpoint; + public static create(properties?: google.cloud.tpu.v2.INetworkEndpoint): google.cloud.tpu.v2.NetworkEndpoint; /** - * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2.NetworkEndpoint.verify|verify} messages. * @param message NetworkEndpoint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.NetworkEndpoint.verify|verify} messages. * @param message NetworkEndpoint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a NetworkEndpoint message from the specified reader or buffer. @@ -3560,7 +3560,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.NetworkEndpoint; /** * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. @@ -3569,7 +3569,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.NetworkEndpoint; /** * Verifies a NetworkEndpoint message. @@ -3583,7 +3583,7 @@ export namespace google { * @param object Plain object * @returns NetworkEndpoint */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkEndpoint; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.NetworkEndpoint; /** * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. @@ -3591,7 +3591,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.NetworkEndpoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.NetworkEndpoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this NetworkEndpoint to JSON. @@ -3621,7 +3621,7 @@ export namespace google { * Constructs a new AccessConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IAccessConfig); + constructor(properties?: google.cloud.tpu.v2.IAccessConfig); /** AccessConfig externalIp. */ public externalIp: string; @@ -3631,23 +3631,23 @@ export namespace google { * @param [properties] Properties to set * @returns AccessConfig instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IAccessConfig): google.cloud.tpu.v2alpha1.AccessConfig; + public static create(properties?: google.cloud.tpu.v2.IAccessConfig): google.cloud.tpu.v2.AccessConfig; /** - * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2.AccessConfig.verify|verify} messages. * @param message AccessConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AccessConfig.verify|verify} messages. * @param message AccessConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes an AccessConfig message from the specified reader or buffer. @@ -3657,7 +3657,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.AccessConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.AccessConfig; /** * Decodes an AccessConfig message from the specified reader or buffer, length delimited. @@ -3666,7 +3666,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.AccessConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.AccessConfig; /** * Verifies an AccessConfig message. @@ -3680,7 +3680,7 @@ export namespace google { * @param object Plain object * @returns AccessConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AccessConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.AccessConfig; /** * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. @@ -3688,7 +3688,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.AccessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.AccessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this AccessConfig to JSON. @@ -3715,6 +3715,9 @@ export namespace google { /** NetworkConfig enableExternalIps */ enableExternalIps?: (boolean|null); + + /** NetworkConfig canIpForward */ + canIpForward?: (boolean|null); } /** Represents a NetworkConfig. */ @@ -3724,7 +3727,7 @@ export namespace google { * Constructs a new NetworkConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.INetworkConfig); + constructor(properties?: google.cloud.tpu.v2.INetworkConfig); /** NetworkConfig network. */ public network: string; @@ -3735,28 +3738,31 @@ export namespace google { /** NetworkConfig enableExternalIps. */ public enableExternalIps: boolean; + /** NetworkConfig canIpForward. */ + public canIpForward: boolean; + /** * Creates a new NetworkConfig instance using the specified properties. * @param [properties] Properties to set * @returns NetworkConfig instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.INetworkConfig): google.cloud.tpu.v2alpha1.NetworkConfig; + public static create(properties?: google.cloud.tpu.v2.INetworkConfig): google.cloud.tpu.v2.NetworkConfig; /** - * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2.NetworkConfig.verify|verify} messages. * @param message NetworkConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.NetworkConfig.verify|verify} messages. * @param message NetworkConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a NetworkConfig message from the specified reader or buffer. @@ -3766,7 +3772,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.NetworkConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.NetworkConfig; /** * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. @@ -3775,7 +3781,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.NetworkConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.NetworkConfig; /** * Verifies a NetworkConfig message. @@ -3789,7 +3795,7 @@ export namespace google { * @param object Plain object * @returns NetworkConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.NetworkConfig; /** * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. @@ -3797,7 +3803,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.NetworkConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.NetworkConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this NetworkConfig to JSON. @@ -3830,7 +3836,7 @@ export namespace google { * Constructs a new ServiceAccount. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IServiceAccount); + constructor(properties?: google.cloud.tpu.v2.IServiceAccount); /** ServiceAccount email. */ public email: string; @@ -3843,23 +3849,23 @@ export namespace google { * @param [properties] Properties to set * @returns ServiceAccount instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IServiceAccount): google.cloud.tpu.v2alpha1.ServiceAccount; + public static create(properties?: google.cloud.tpu.v2.IServiceAccount): google.cloud.tpu.v2.ServiceAccount; /** - * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2.ServiceAccount.verify|verify} messages. * @param message ServiceAccount message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ServiceAccount.verify|verify} messages. * @param message ServiceAccount message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a ServiceAccount message from the specified reader or buffer. @@ -3869,7 +3875,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ServiceAccount; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.ServiceAccount; /** * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. @@ -3878,7 +3884,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ServiceAccount; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.ServiceAccount; /** * Verifies a ServiceAccount message. @@ -3892,7 +3898,7 @@ export namespace google { * @param object Plain object * @returns ServiceAccount */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ServiceAccount; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ServiceAccount; /** * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. @@ -3900,7 +3906,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ServiceAccount, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.ServiceAccount, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this ServiceAccount to JSON. @@ -3929,7 +3935,7 @@ export namespace google { acceleratorType?: (string|null); /** Node state */ - state?: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State|null); + state?: (google.cloud.tpu.v2.Node.State|keyof typeof google.cloud.tpu.v2.Node.State|null); /** Node healthDescription */ healthDescription?: (string|null); @@ -3938,25 +3944,25 @@ export namespace google { runtimeVersion?: (string|null); /** Node networkConfig */ - networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + networkConfig?: (google.cloud.tpu.v2.INetworkConfig|null); /** Node cidrBlock */ cidrBlock?: (string|null); /** Node serviceAccount */ - serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + serviceAccount?: (google.cloud.tpu.v2.IServiceAccount|null); /** Node createTime */ createTime?: (google.protobuf.ITimestamp|null); /** Node schedulingConfig */ - schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + schedulingConfig?: (google.cloud.tpu.v2.ISchedulingConfig|null); /** Node networkEndpoints */ - networkEndpoints?: (google.cloud.tpu.v2alpha1.INetworkEndpoint[]|null); + networkEndpoints?: (google.cloud.tpu.v2.INetworkEndpoint[]|null); /** Node health */ - health?: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health|null); + health?: (google.cloud.tpu.v2.Node.Health|keyof typeof google.cloud.tpu.v2.Node.Health|null); /** Node labels */ labels?: ({ [k: string]: string }|null); @@ -3971,16 +3977,16 @@ export namespace google { id?: (number|Long|string|null); /** Node dataDisks */ - dataDisks?: (google.cloud.tpu.v2alpha1.IAttachedDisk[]|null); + dataDisks?: (google.cloud.tpu.v2.IAttachedDisk[]|null); /** Node apiVersion */ - apiVersion?: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion|null); + apiVersion?: (google.cloud.tpu.v2.Node.ApiVersion|keyof typeof google.cloud.tpu.v2.Node.ApiVersion|null); /** Node symptoms */ - symptoms?: (google.cloud.tpu.v2alpha1.ISymptom[]|null); + symptoms?: (google.cloud.tpu.v2.ISymptom[]|null); /** Node shieldedInstanceConfig */ - shieldedInstanceConfig?: (google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null); + shieldedInstanceConfig?: (google.cloud.tpu.v2.IShieldedInstanceConfig|null); } /** Represents a Node. */ @@ -3990,7 +3996,7 @@ export namespace google { * Constructs a new Node. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.INode); + constructor(properties?: google.cloud.tpu.v2.INode); /** Node name. */ public name: string; @@ -4002,7 +4008,7 @@ export namespace google { public acceleratorType: string; /** Node state. */ - public state: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State); + public state: (google.cloud.tpu.v2.Node.State|keyof typeof google.cloud.tpu.v2.Node.State); /** Node healthDescription. */ public healthDescription: string; @@ -4011,25 +4017,25 @@ export namespace google { public runtimeVersion: string; /** Node networkConfig. */ - public networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + public networkConfig?: (google.cloud.tpu.v2.INetworkConfig|null); /** Node cidrBlock. */ public cidrBlock: string; /** Node serviceAccount. */ - public serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + public serviceAccount?: (google.cloud.tpu.v2.IServiceAccount|null); /** Node createTime. */ public createTime?: (google.protobuf.ITimestamp|null); /** Node schedulingConfig. */ - public schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + public schedulingConfig?: (google.cloud.tpu.v2.ISchedulingConfig|null); /** Node networkEndpoints. */ - public networkEndpoints: google.cloud.tpu.v2alpha1.INetworkEndpoint[]; + public networkEndpoints: google.cloud.tpu.v2.INetworkEndpoint[]; /** Node health. */ - public health: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health); + public health: (google.cloud.tpu.v2.Node.Health|keyof typeof google.cloud.tpu.v2.Node.Health); /** Node labels. */ public labels: { [k: string]: string }; @@ -4044,39 +4050,39 @@ export namespace google { public id: (number|Long|string); /** Node dataDisks. */ - public dataDisks: google.cloud.tpu.v2alpha1.IAttachedDisk[]; + public dataDisks: google.cloud.tpu.v2.IAttachedDisk[]; /** Node apiVersion. */ - public apiVersion: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion); + public apiVersion: (google.cloud.tpu.v2.Node.ApiVersion|keyof typeof google.cloud.tpu.v2.Node.ApiVersion); /** Node symptoms. */ - public symptoms: google.cloud.tpu.v2alpha1.ISymptom[]; + public symptoms: google.cloud.tpu.v2.ISymptom[]; /** Node shieldedInstanceConfig. */ - public shieldedInstanceConfig?: (google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null); + public shieldedInstanceConfig?: (google.cloud.tpu.v2.IShieldedInstanceConfig|null); /** * Creates a new Node instance using the specified properties. * @param [properties] Properties to set * @returns Node instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.INode): google.cloud.tpu.v2alpha1.Node; + public static create(properties?: google.cloud.tpu.v2.INode): google.cloud.tpu.v2.Node; /** - * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2.Node.verify|verify} messages. * @param message Node message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.INode, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.Node.verify|verify} messages. * @param message Node message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.INode, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a Node message from the specified reader or buffer. @@ -4086,7 +4092,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.Node; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.Node; /** * Decodes a Node message from the specified reader or buffer, length delimited. @@ -4095,7 +4101,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.Node; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.Node; /** * Verifies a Node message. @@ -4109,7 +4115,7 @@ export namespace google { * @param object Plain object * @returns Node */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Node; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.Node; /** * Creates a plain object from a Node message. Also converts values to other types if specified. @@ -4117,7 +4123,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.Node, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.Node, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this Node to JSON. @@ -4168,7 +4174,8 @@ export namespace google { API_VERSION_UNSPECIFIED = 0, V1_ALPHA1 = 1, V1 = 2, - V2_ALPHA1 = 3 + V2_ALPHA1 = 3, + V2 = 4 } } @@ -4192,7 +4199,7 @@ export namespace google { * Constructs a new ListNodesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest); + constructor(properties?: google.cloud.tpu.v2.IListNodesRequest); /** ListNodesRequest parent. */ public parent: string; @@ -4208,23 +4215,23 @@ export namespace google { * @param [properties] Properties to set * @returns ListNodesRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest): google.cloud.tpu.v2alpha1.ListNodesRequest; + public static create(properties?: google.cloud.tpu.v2.IListNodesRequest): google.cloud.tpu.v2.ListNodesRequest; /** - * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListNodesRequest.verify|verify} messages. * @param message ListNodesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListNodesRequest.verify|verify} messages. * @param message ListNodesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a ListNodesRequest message from the specified reader or buffer. @@ -4234,7 +4241,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ListNodesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.ListNodesRequest; /** * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. @@ -4243,7 +4250,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ListNodesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.ListNodesRequest; /** * Verifies a ListNodesRequest message. @@ -4257,7 +4264,7 @@ export namespace google { * @param object Plain object * @returns ListNodesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListNodesRequest; /** * Creates a plain object from a ListNodesRequest message. Also converts values to other types if specified. @@ -4265,7 +4272,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.ListNodesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this ListNodesRequest to JSON. @@ -4285,7 +4292,7 @@ export namespace google { interface IListNodesResponse { /** ListNodesResponse nodes */ - nodes?: (google.cloud.tpu.v2alpha1.INode[]|null); + nodes?: (google.cloud.tpu.v2.INode[]|null); /** ListNodesResponse nextPageToken */ nextPageToken?: (string|null); @@ -4301,10 +4308,10 @@ export namespace google { * Constructs a new ListNodesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse); + constructor(properties?: google.cloud.tpu.v2.IListNodesResponse); /** ListNodesResponse nodes. */ - public nodes: google.cloud.tpu.v2alpha1.INode[]; + public nodes: google.cloud.tpu.v2.INode[]; /** ListNodesResponse nextPageToken. */ public nextPageToken: string; @@ -4317,23 +4324,23 @@ export namespace google { * @param [properties] Properties to set * @returns ListNodesResponse instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse): google.cloud.tpu.v2alpha1.ListNodesResponse; + public static create(properties?: google.cloud.tpu.v2.IListNodesResponse): google.cloud.tpu.v2.ListNodesResponse; /** - * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListNodesResponse.verify|verify} messages. * @param message ListNodesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListNodesResponse.verify|verify} messages. * @param message ListNodesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a ListNodesResponse message from the specified reader or buffer. @@ -4343,7 +4350,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ListNodesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.ListNodesResponse; /** * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. @@ -4352,7 +4359,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.ListNodesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.ListNodesResponse; /** * Verifies a ListNodesResponse message. @@ -4366,7 +4373,7 @@ export namespace google { * @param object Plain object * @returns ListNodesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListNodesResponse; /** * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. @@ -4374,7 +4381,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.ListNodesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this ListNodesResponse to JSON. @@ -4404,7 +4411,7 @@ export namespace google { * Constructs a new GetNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest); + constructor(properties?: google.cloud.tpu.v2.IGetNodeRequest); /** GetNodeRequest name. */ public name: string; @@ -4414,23 +4421,23 @@ export namespace google { * @param [properties] Properties to set * @returns GetNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest): google.cloud.tpu.v2alpha1.GetNodeRequest; + public static create(properties?: google.cloud.tpu.v2.IGetNodeRequest): google.cloud.tpu.v2.GetNodeRequest; /** - * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetNodeRequest.verify|verify} messages. * @param message GetNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetNodeRequest.verify|verify} messages. * @param message GetNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a GetNodeRequest message from the specified reader or buffer. @@ -4440,7 +4447,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GetNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.GetNodeRequest; /** * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. @@ -4449,7 +4456,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.GetNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.GetNodeRequest; /** * Verifies a GetNodeRequest message. @@ -4463,7 +4470,7 @@ export namespace google { * @param object Plain object * @returns GetNodeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GetNodeRequest; /** * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. @@ -4471,7 +4478,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.GetNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.GetNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this GetNodeRequest to JSON. @@ -4497,7 +4504,7 @@ export namespace google { nodeId?: (string|null); /** CreateNodeRequest node */ - node?: (google.cloud.tpu.v2alpha1.INode|null); + node?: (google.cloud.tpu.v2.INode|null); } /** Represents a CreateNodeRequest. */ @@ -4507,7 +4514,7 @@ export namespace google { * Constructs a new CreateNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest); + constructor(properties?: google.cloud.tpu.v2.ICreateNodeRequest); /** CreateNodeRequest parent. */ public parent: string; @@ -4516,30 +4523,30 @@ export namespace google { public nodeId: string; /** CreateNodeRequest node. */ - public node?: (google.cloud.tpu.v2alpha1.INode|null); + public node?: (google.cloud.tpu.v2.INode|null); /** * Creates a new CreateNodeRequest instance using the specified properties. * @param [properties] Properties to set * @returns CreateNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest): google.cloud.tpu.v2alpha1.CreateNodeRequest; + public static create(properties?: google.cloud.tpu.v2.ICreateNodeRequest): google.cloud.tpu.v2.CreateNodeRequest; /** - * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.CreateNodeRequest.verify|verify} messages. * @param message CreateNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.CreateNodeRequest.verify|verify} messages. * @param message CreateNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a CreateNodeRequest message from the specified reader or buffer. @@ -4549,7 +4556,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.CreateNodeRequest; /** * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. @@ -4558,7 +4565,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.CreateNodeRequest; /** * Verifies a CreateNodeRequest message. @@ -4572,7 +4579,7 @@ export namespace google { * @param object Plain object * @returns CreateNodeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.CreateNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.CreateNodeRequest; /** * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. @@ -4580,7 +4587,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.CreateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.CreateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this CreateNodeRequest to JSON. @@ -4610,7 +4617,7 @@ export namespace google { * Constructs a new DeleteNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest); + constructor(properties?: google.cloud.tpu.v2.IDeleteNodeRequest); /** DeleteNodeRequest name. */ public name: string; @@ -4620,23 +4627,23 @@ export namespace google { * @param [properties] Properties to set * @returns DeleteNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + public static create(properties?: google.cloud.tpu.v2.IDeleteNodeRequest): google.cloud.tpu.v2.DeleteNodeRequest; /** - * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.DeleteNodeRequest.verify|verify} messages. * @param message DeleteNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.DeleteNodeRequest.verify|verify} messages. * @param message DeleteNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a DeleteNodeRequest message from the specified reader or buffer. @@ -4646,7 +4653,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.DeleteNodeRequest; /** * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. @@ -4655,7 +4662,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.DeleteNodeRequest; /** * Verifies a DeleteNodeRequest message. @@ -4669,7 +4676,7 @@ export namespace google { * @param object Plain object * @returns DeleteNodeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.DeleteNodeRequest; /** * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. @@ -4677,7 +4684,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.DeleteNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.DeleteNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this DeleteNodeRequest to JSON. @@ -4707,7 +4714,7 @@ export namespace google { * Constructs a new StopNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest); + constructor(properties?: google.cloud.tpu.v2.IStopNodeRequest); /** StopNodeRequest name. */ public name: string; @@ -4717,23 +4724,23 @@ export namespace google { * @param [properties] Properties to set * @returns StopNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest): google.cloud.tpu.v2alpha1.StopNodeRequest; + public static create(properties?: google.cloud.tpu.v2.IStopNodeRequest): google.cloud.tpu.v2.StopNodeRequest; /** - * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.StopNodeRequest.verify|verify} messages. * @param message StopNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.StopNodeRequest.verify|verify} messages. * @param message StopNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a StopNodeRequest message from the specified reader or buffer. @@ -4743,7 +4750,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.StopNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.StopNodeRequest; /** * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. @@ -4752,7 +4759,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.StopNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.StopNodeRequest; /** * Verifies a StopNodeRequest message. @@ -4766,7 +4773,7 @@ export namespace google { * @param object Plain object * @returns StopNodeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StopNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.StopNodeRequest; /** * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. @@ -4774,7 +4781,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.StopNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.StopNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this StopNodeRequest to JSON. @@ -4804,7 +4811,7 @@ export namespace google { * Constructs a new StartNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest); + constructor(properties?: google.cloud.tpu.v2.IStartNodeRequest); /** StartNodeRequest name. */ public name: string; @@ -4814,23 +4821,23 @@ export namespace google { * @param [properties] Properties to set * @returns StartNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest): google.cloud.tpu.v2alpha1.StartNodeRequest; + public static create(properties?: google.cloud.tpu.v2.IStartNodeRequest): google.cloud.tpu.v2.StartNodeRequest; /** - * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.StartNodeRequest.verify|verify} messages. * @param message StartNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.StartNodeRequest.verify|verify} messages. * @param message StartNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes a StartNodeRequest message from the specified reader or buffer. @@ -4840,7 +4847,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.StartNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2.StartNodeRequest; /** * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. @@ -4849,7 +4856,7 @@ export namespace google { * @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.cloud.tpu.v2alpha1.StartNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2.StartNodeRequest; /** * Verifies a StartNodeRequest message. @@ -4863,7 +4870,7 @@ export namespace google { * @param object Plain object * @returns StartNodeRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StartNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.StartNodeRequest; /** * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. @@ -4871,7 +4878,7 @@ export namespace google { * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.StartNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2.StartNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** * Converts this StartNodeRequest to JSON. @@ -4894,7 +4901,7 @@ export namespace google { updateMask?: (google.protobuf.IFieldMask|null); /** UpdateNodeRequest node */ - node?: (google.cloud.tpu.v2alpha1.INode|null); + node?: (google.cloud.tpu.v2.INode|null); } /** Represents an UpdateNodeRequest. */ @@ -4904,86 +4911,6343 @@ export namespace google { * Constructs a new UpdateNodeRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest); + constructor(properties?: google.cloud.tpu.v2.IUpdateNodeRequest); /** UpdateNodeRequest updateMask. */ public updateMask?: (google.protobuf.IFieldMask|null); /** UpdateNodeRequest node. */ - public node?: (google.cloud.tpu.v2alpha1.INode|null); + public node?: (google.cloud.tpu.v2.INode|null); /** * Creates a new UpdateNodeRequest instance using the specified properties. * @param [properties] Properties to set * @returns UpdateNodeRequest instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + public static create(properties?: google.cloud.tpu.v2.IUpdateNodeRequest): google.cloud.tpu.v2.UpdateNodeRequest; /** - * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.UpdateNodeRequest.verify|verify} messages. * @param message UpdateNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.UpdateNodeRequest.verify|verify} messages. * @param message UpdateNodeRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** * Decodes an UpdateNodeRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateNodeRequest + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2.UpdateNodeRequest; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2.UpdateNodeRequest; + + /** + * Verifies an UpdateNodeRequest 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 an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.UpdateNodeRequest; + + /** + * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. + * @param message UpdateNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.UpdateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceIdentity. */ + interface IServiceIdentity { + + /** ServiceIdentity email */ + email?: (string|null); + } + + /** Represents a ServiceIdentity. */ + class ServiceIdentity implements IServiceIdentity { + + /** + * Constructs a new ServiceIdentity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IServiceIdentity); + + /** ServiceIdentity email. */ + public email: string; + + /** + * Creates a new ServiceIdentity instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceIdentity instance + */ + public static create(properties?: google.cloud.tpu.v2.IServiceIdentity): google.cloud.tpu.v2.ServiceIdentity; + + /** + * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2.ServiceIdentity.verify|verify} messages. + * @param message ServiceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IServiceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ServiceIdentity.verify|verify} messages. + * @param message ServiceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IServiceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceIdentity + * @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.cloud.tpu.v2.ServiceIdentity; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceIdentity + * @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.cloud.tpu.v2.ServiceIdentity; + + /** + * Verifies a ServiceIdentity 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 ServiceIdentity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceIdentity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ServiceIdentity; + + /** + * Creates a plain object from a ServiceIdentity message. Also converts values to other types if specified. + * @param message ServiceIdentity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ServiceIdentity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceIdentity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceIdentity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateServiceIdentityRequest. */ + interface IGenerateServiceIdentityRequest { + + /** GenerateServiceIdentityRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateServiceIdentityRequest. */ + class GenerateServiceIdentityRequest implements IGenerateServiceIdentityRequest { + + /** + * Constructs a new GenerateServiceIdentityRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGenerateServiceIdentityRequest); + + /** GenerateServiceIdentityRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateServiceIdentityRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateServiceIdentityRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IGenerateServiceIdentityRequest): google.cloud.tpu.v2.GenerateServiceIdentityRequest; + + /** + * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityRequest.verify|verify} messages. + * @param message GenerateServiceIdentityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGenerateServiceIdentityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityRequest.verify|verify} messages. + * @param message GenerateServiceIdentityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGenerateServiceIdentityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateServiceIdentityRequest + * @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.cloud.tpu.v2.GenerateServiceIdentityRequest; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateServiceIdentityRequest + * @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.cloud.tpu.v2.GenerateServiceIdentityRequest; + + /** + * Verifies a GenerateServiceIdentityRequest 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 GenerateServiceIdentityRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateServiceIdentityRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GenerateServiceIdentityRequest; + + /** + * Creates a plain object from a GenerateServiceIdentityRequest message. Also converts values to other types if specified. + * @param message GenerateServiceIdentityRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GenerateServiceIdentityRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateServiceIdentityRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateServiceIdentityRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateServiceIdentityResponse. */ + interface IGenerateServiceIdentityResponse { + + /** GenerateServiceIdentityResponse identity */ + identity?: (google.cloud.tpu.v2.IServiceIdentity|null); + } + + /** Represents a GenerateServiceIdentityResponse. */ + class GenerateServiceIdentityResponse implements IGenerateServiceIdentityResponse { + + /** + * Constructs a new GenerateServiceIdentityResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGenerateServiceIdentityResponse); + + /** GenerateServiceIdentityResponse identity. */ + public identity?: (google.cloud.tpu.v2.IServiceIdentity|null); + + /** + * Creates a new GenerateServiceIdentityResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateServiceIdentityResponse instance + */ + public static create(properties?: google.cloud.tpu.v2.IGenerateServiceIdentityResponse): google.cloud.tpu.v2.GenerateServiceIdentityResponse; + + /** + * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityResponse.verify|verify} messages. + * @param message GenerateServiceIdentityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGenerateServiceIdentityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityResponse.verify|verify} messages. + * @param message GenerateServiceIdentityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGenerateServiceIdentityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateServiceIdentityResponse + * @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.cloud.tpu.v2.GenerateServiceIdentityResponse; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateServiceIdentityResponse + * @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.cloud.tpu.v2.GenerateServiceIdentityResponse; + + /** + * Verifies a GenerateServiceIdentityResponse 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 GenerateServiceIdentityResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateServiceIdentityResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GenerateServiceIdentityResponse; + + /** + * Creates a plain object from a GenerateServiceIdentityResponse message. Also converts values to other types if specified. + * @param message GenerateServiceIdentityResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GenerateServiceIdentityResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateServiceIdentityResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateServiceIdentityResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AcceleratorType. */ + interface IAcceleratorType { + + /** AcceleratorType name */ + name?: (string|null); + + /** AcceleratorType type */ + type?: (string|null); + } + + /** Represents an AcceleratorType. */ + class AcceleratorType implements IAcceleratorType { + + /** + * Constructs a new AcceleratorType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IAcceleratorType); + + /** AcceleratorType name. */ + public name: string; + + /** AcceleratorType type. */ + public type: string; + + /** + * Creates a new AcceleratorType instance using the specified properties. + * @param [properties] Properties to set + * @returns AcceleratorType instance + */ + public static create(properties?: google.cloud.tpu.v2.IAcceleratorType): google.cloud.tpu.v2.AcceleratorType; + + /** + * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2.AcceleratorType.verify|verify} messages. + * @param message AcceleratorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IAcceleratorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AcceleratorType.verify|verify} messages. + * @param message AcceleratorType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IAcceleratorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcceleratorType + * @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.cloud.tpu.v2.AcceleratorType; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcceleratorType + * @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.cloud.tpu.v2.AcceleratorType; + + /** + * Verifies an AcceleratorType 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 an AcceleratorType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcceleratorType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.AcceleratorType; + + /** + * Creates a plain object from an AcceleratorType message. Also converts values to other types if specified. + * @param message AcceleratorType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.AcceleratorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcceleratorType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AcceleratorType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetAcceleratorTypeRequest. */ + interface IGetAcceleratorTypeRequest { + + /** GetAcceleratorTypeRequest name */ + name?: (string|null); + } + + /** Represents a GetAcceleratorTypeRequest. */ + class GetAcceleratorTypeRequest implements IGetAcceleratorTypeRequest { + + /** + * Constructs a new GetAcceleratorTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGetAcceleratorTypeRequest); + + /** GetAcceleratorTypeRequest name. */ + public name: string; + + /** + * Creates a new GetAcceleratorTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAcceleratorTypeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IGetAcceleratorTypeRequest): google.cloud.tpu.v2.GetAcceleratorTypeRequest; + + /** + * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetAcceleratorTypeRequest.verify|verify} messages. + * @param message GetAcceleratorTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGetAcceleratorTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetAcceleratorTypeRequest.verify|verify} messages. + * @param message GetAcceleratorTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGetAcceleratorTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAcceleratorTypeRequest + * @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.cloud.tpu.v2.GetAcceleratorTypeRequest; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAcceleratorTypeRequest + * @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.cloud.tpu.v2.GetAcceleratorTypeRequest; + + /** + * Verifies a GetAcceleratorTypeRequest 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 GetAcceleratorTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAcceleratorTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GetAcceleratorTypeRequest; + + /** + * Creates a plain object from a GetAcceleratorTypeRequest message. Also converts values to other types if specified. + * @param message GetAcceleratorTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GetAcceleratorTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAcceleratorTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAcceleratorTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAcceleratorTypesRequest. */ + interface IListAcceleratorTypesRequest { + + /** ListAcceleratorTypesRequest parent */ + parent?: (string|null); + + /** ListAcceleratorTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListAcceleratorTypesRequest pageToken */ + pageToken?: (string|null); + + /** ListAcceleratorTypesRequest filter */ + filter?: (string|null); + + /** ListAcceleratorTypesRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListAcceleratorTypesRequest. */ + class ListAcceleratorTypesRequest implements IListAcceleratorTypesRequest { + + /** + * Constructs a new ListAcceleratorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IListAcceleratorTypesRequest); + + /** ListAcceleratorTypesRequest parent. */ + public parent: string; + + /** ListAcceleratorTypesRequest pageSize. */ + public pageSize: number; + + /** ListAcceleratorTypesRequest pageToken. */ + public pageToken: string; + + /** ListAcceleratorTypesRequest filter. */ + public filter: string; + + /** ListAcceleratorTypesRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListAcceleratorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAcceleratorTypesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IListAcceleratorTypesRequest): google.cloud.tpu.v2.ListAcceleratorTypesRequest; + + /** + * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesRequest.verify|verify} messages. + * @param message ListAcceleratorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IListAcceleratorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesRequest.verify|verify} messages. + * @param message ListAcceleratorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IListAcceleratorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAcceleratorTypesRequest + * @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.cloud.tpu.v2.ListAcceleratorTypesRequest; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAcceleratorTypesRequest + * @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.cloud.tpu.v2.ListAcceleratorTypesRequest; + + /** + * Verifies a ListAcceleratorTypesRequest 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 ListAcceleratorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAcceleratorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListAcceleratorTypesRequest; + + /** + * Creates a plain object from a ListAcceleratorTypesRequest message. Also converts values to other types if specified. + * @param message ListAcceleratorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ListAcceleratorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAcceleratorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAcceleratorTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAcceleratorTypesResponse. */ + interface IListAcceleratorTypesResponse { + + /** ListAcceleratorTypesResponse acceleratorTypes */ + acceleratorTypes?: (google.cloud.tpu.v2.IAcceleratorType[]|null); + + /** ListAcceleratorTypesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListAcceleratorTypesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListAcceleratorTypesResponse. */ + class ListAcceleratorTypesResponse implements IListAcceleratorTypesResponse { + + /** + * Constructs a new ListAcceleratorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IListAcceleratorTypesResponse); + + /** ListAcceleratorTypesResponse acceleratorTypes. */ + public acceleratorTypes: google.cloud.tpu.v2.IAcceleratorType[]; + + /** ListAcceleratorTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListAcceleratorTypesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListAcceleratorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAcceleratorTypesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2.IListAcceleratorTypesResponse): google.cloud.tpu.v2.ListAcceleratorTypesResponse; + + /** + * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesResponse.verify|verify} messages. + * @param message ListAcceleratorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IListAcceleratorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesResponse.verify|verify} messages. + * @param message ListAcceleratorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IListAcceleratorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAcceleratorTypesResponse + * @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.cloud.tpu.v2.ListAcceleratorTypesResponse; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAcceleratorTypesResponse + * @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.cloud.tpu.v2.ListAcceleratorTypesResponse; + + /** + * Verifies a ListAcceleratorTypesResponse 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 ListAcceleratorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAcceleratorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListAcceleratorTypesResponse; + + /** + * Creates a plain object from a ListAcceleratorTypesResponse message. Also converts values to other types if specified. + * @param message ListAcceleratorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ListAcceleratorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAcceleratorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAcceleratorTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RuntimeVersion. */ + interface IRuntimeVersion { + + /** RuntimeVersion name */ + name?: (string|null); + + /** RuntimeVersion version */ + version?: (string|null); + } + + /** Represents a RuntimeVersion. */ + class RuntimeVersion implements IRuntimeVersion { + + /** + * Constructs a new RuntimeVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IRuntimeVersion); + + /** RuntimeVersion name. */ + public name: string; + + /** RuntimeVersion version. */ + public version: string; + + /** + * Creates a new RuntimeVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns RuntimeVersion instance + */ + public static create(properties?: google.cloud.tpu.v2.IRuntimeVersion): google.cloud.tpu.v2.RuntimeVersion; + + /** + * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2.RuntimeVersion.verify|verify} messages. + * @param message RuntimeVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IRuntimeVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.RuntimeVersion.verify|verify} messages. + * @param message RuntimeVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IRuntimeVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RuntimeVersion + * @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.cloud.tpu.v2.RuntimeVersion; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RuntimeVersion + * @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.cloud.tpu.v2.RuntimeVersion; + + /** + * Verifies a RuntimeVersion 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 RuntimeVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RuntimeVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.RuntimeVersion; + + /** + * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. + * @param message RuntimeVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.RuntimeVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RuntimeVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RuntimeVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetRuntimeVersionRequest. */ + interface IGetRuntimeVersionRequest { + + /** GetRuntimeVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetRuntimeVersionRequest. */ + class GetRuntimeVersionRequest implements IGetRuntimeVersionRequest { + + /** + * Constructs a new GetRuntimeVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGetRuntimeVersionRequest); + + /** GetRuntimeVersionRequest name. */ + public name: string; + + /** + * Creates a new GetRuntimeVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetRuntimeVersionRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IGetRuntimeVersionRequest): google.cloud.tpu.v2.GetRuntimeVersionRequest; + + /** + * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetRuntimeVersionRequest.verify|verify} messages. + * @param message GetRuntimeVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGetRuntimeVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetRuntimeVersionRequest.verify|verify} messages. + * @param message GetRuntimeVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGetRuntimeVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetRuntimeVersionRequest + * @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.cloud.tpu.v2.GetRuntimeVersionRequest; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetRuntimeVersionRequest + * @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.cloud.tpu.v2.GetRuntimeVersionRequest; + + /** + * Verifies a GetRuntimeVersionRequest 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 GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetRuntimeVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GetRuntimeVersionRequest; + + /** + * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. + * @param message GetRuntimeVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GetRuntimeVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetRuntimeVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetRuntimeVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRuntimeVersionsRequest. */ + interface IListRuntimeVersionsRequest { + + /** ListRuntimeVersionsRequest parent */ + parent?: (string|null); + + /** ListRuntimeVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListRuntimeVersionsRequest pageToken */ + pageToken?: (string|null); + + /** ListRuntimeVersionsRequest filter */ + filter?: (string|null); + + /** ListRuntimeVersionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListRuntimeVersionsRequest. */ + class ListRuntimeVersionsRequest implements IListRuntimeVersionsRequest { + + /** + * Constructs a new ListRuntimeVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IListRuntimeVersionsRequest); + + /** ListRuntimeVersionsRequest parent. */ + public parent: string; + + /** ListRuntimeVersionsRequest pageSize. */ + public pageSize: number; + + /** ListRuntimeVersionsRequest pageToken. */ + public pageToken: string; + + /** ListRuntimeVersionsRequest filter. */ + public filter: string; + + /** ListRuntimeVersionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListRuntimeVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimeVersionsRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IListRuntimeVersionsRequest): google.cloud.tpu.v2.ListRuntimeVersionsRequest; + + /** + * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsRequest.verify|verify} messages. + * @param message ListRuntimeVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IListRuntimeVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsRequest.verify|verify} messages. + * @param message ListRuntimeVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IListRuntimeVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimeVersionsRequest + * @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.cloud.tpu.v2.ListRuntimeVersionsRequest; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimeVersionsRequest + * @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.cloud.tpu.v2.ListRuntimeVersionsRequest; + + /** + * Verifies a ListRuntimeVersionsRequest 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 ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimeVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListRuntimeVersionsRequest; + + /** + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ListRuntimeVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimeVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimeVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRuntimeVersionsResponse. */ + interface IListRuntimeVersionsResponse { + + /** ListRuntimeVersionsResponse runtimeVersions */ + runtimeVersions?: (google.cloud.tpu.v2.IRuntimeVersion[]|null); + + /** ListRuntimeVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListRuntimeVersionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListRuntimeVersionsResponse. */ + class ListRuntimeVersionsResponse implements IListRuntimeVersionsResponse { + + /** + * Constructs a new ListRuntimeVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IListRuntimeVersionsResponse); + + /** ListRuntimeVersionsResponse runtimeVersions. */ + public runtimeVersions: google.cloud.tpu.v2.IRuntimeVersion[]; + + /** ListRuntimeVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListRuntimeVersionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimeVersionsResponse instance + */ + public static create(properties?: google.cloud.tpu.v2.IListRuntimeVersionsResponse): google.cloud.tpu.v2.ListRuntimeVersionsResponse; + + /** + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2.ListRuntimeVersionsResponse; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2.ListRuntimeVersionsResponse; + + /** + * Verifies a ListRuntimeVersionsResponse 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 ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimeVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ListRuntimeVersionsResponse; + + /** + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ListRuntimeVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimeVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimeVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.tpu.v2.IOperationMetadata): google.cloud.tpu.v2.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @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.cloud.tpu.v2.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @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.cloud.tpu.v2.OperationMetadata; + + /** + * Verifies an OperationMetadata 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Symptom. */ + interface ISymptom { + + /** Symptom createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Symptom symptomType */ + symptomType?: (google.cloud.tpu.v2.Symptom.SymptomType|keyof typeof google.cloud.tpu.v2.Symptom.SymptomType|null); + + /** Symptom details */ + details?: (string|null); + + /** Symptom workerId */ + workerId?: (string|null); + } + + /** Represents a Symptom. */ + class Symptom implements ISymptom { + + /** + * Constructs a new Symptom. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.ISymptom); + + /** Symptom createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Symptom symptomType. */ + public symptomType: (google.cloud.tpu.v2.Symptom.SymptomType|keyof typeof google.cloud.tpu.v2.Symptom.SymptomType); + + /** Symptom details. */ + public details: string; + + /** Symptom workerId. */ + public workerId: string; + + /** + * Creates a new Symptom instance using the specified properties. + * @param [properties] Properties to set + * @returns Symptom instance + */ + public static create(properties?: google.cloud.tpu.v2.ISymptom): google.cloud.tpu.v2.Symptom; + + /** + * Encodes the specified Symptom message. Does not implicitly {@link google.cloud.tpu.v2.Symptom.verify|verify} messages. + * @param message Symptom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.ISymptom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symptom message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.Symptom.verify|verify} messages. + * @param message Symptom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.ISymptom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symptom message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symptom + * @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.cloud.tpu.v2.Symptom; + + /** + * Decodes a Symptom message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symptom + * @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.cloud.tpu.v2.Symptom; + + /** + * Verifies a Symptom 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 Symptom message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symptom + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.Symptom; + + /** + * Creates a plain object from a Symptom message. Also converts values to other types if specified. + * @param message Symptom + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.Symptom, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symptom to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Symptom + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Symptom { + + /** SymptomType enum. */ + enum SymptomType { + SYMPTOM_TYPE_UNSPECIFIED = 0, + LOW_MEMORY = 1, + OUT_OF_MEMORY = 2, + EXECUTE_TIMED_OUT = 3, + MESH_BUILD_FAIL = 4, + HBM_OUT_OF_MEMORY = 5, + PROJECT_ABUSE = 6 + } + } + + /** Properties of a GetGuestAttributesRequest. */ + interface IGetGuestAttributesRequest { + + /** GetGuestAttributesRequest name */ + name?: (string|null); + + /** GetGuestAttributesRequest queryPath */ + queryPath?: (string|null); + + /** GetGuestAttributesRequest workerIds */ + workerIds?: (string[]|null); + } + + /** Represents a GetGuestAttributesRequest. */ + class GetGuestAttributesRequest implements IGetGuestAttributesRequest { + + /** + * Constructs a new GetGuestAttributesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGetGuestAttributesRequest); + + /** GetGuestAttributesRequest name. */ + public name: string; + + /** GetGuestAttributesRequest queryPath. */ + public queryPath: string; + + /** GetGuestAttributesRequest workerIds. */ + public workerIds: string[]; + + /** + * Creates a new GetGuestAttributesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGuestAttributesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2.IGetGuestAttributesRequest): google.cloud.tpu.v2.GetGuestAttributesRequest; + + /** + * Encodes the specified GetGuestAttributesRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesRequest.verify|verify} messages. + * @param message GetGuestAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGetGuestAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGuestAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesRequest.verify|verify} messages. + * @param message GetGuestAttributesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGetGuestAttributesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGuestAttributesRequest + * @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.cloud.tpu.v2.GetGuestAttributesRequest; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGuestAttributesRequest + * @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.cloud.tpu.v2.GetGuestAttributesRequest; + + /** + * Verifies a GetGuestAttributesRequest 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 GetGuestAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGuestAttributesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GetGuestAttributesRequest; + + /** + * Creates a plain object from a GetGuestAttributesRequest message. Also converts values to other types if specified. + * @param message GetGuestAttributesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GetGuestAttributesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGuestAttributesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetGuestAttributesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetGuestAttributesResponse. */ + interface IGetGuestAttributesResponse { + + /** GetGuestAttributesResponse guestAttributes */ + guestAttributes?: (google.cloud.tpu.v2.IGuestAttributes[]|null); + } + + /** Represents a GetGuestAttributesResponse. */ + class GetGuestAttributesResponse implements IGetGuestAttributesResponse { + + /** + * Constructs a new GetGuestAttributesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IGetGuestAttributesResponse); + + /** GetGuestAttributesResponse guestAttributes. */ + public guestAttributes: google.cloud.tpu.v2.IGuestAttributes[]; + + /** + * Creates a new GetGuestAttributesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGuestAttributesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2.IGetGuestAttributesResponse): google.cloud.tpu.v2.GetGuestAttributesResponse; + + /** + * Encodes the specified GetGuestAttributesResponse message. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesResponse.verify|verify} messages. + * @param message GetGuestAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IGetGuestAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesResponse.verify|verify} messages. + * @param message GetGuestAttributesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IGetGuestAttributesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGuestAttributesResponse + * @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.cloud.tpu.v2.GetGuestAttributesResponse; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGuestAttributesResponse + * @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.cloud.tpu.v2.GetGuestAttributesResponse; + + /** + * Verifies a GetGuestAttributesResponse 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 GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGuestAttributesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.GetGuestAttributesResponse; + + /** + * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * @param message GetGuestAttributesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.GetGuestAttributesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGuestAttributesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetGuestAttributesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ShieldedInstanceConfig. */ + interface IShieldedInstanceConfig { + + /** ShieldedInstanceConfig enableSecureBoot */ + enableSecureBoot?: (boolean|null); + } + + /** Represents a ShieldedInstanceConfig. */ + class ShieldedInstanceConfig implements IShieldedInstanceConfig { + + /** + * Constructs a new ShieldedInstanceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2.IShieldedInstanceConfig); + + /** ShieldedInstanceConfig enableSecureBoot. */ + public enableSecureBoot: boolean; + + /** + * Creates a new ShieldedInstanceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ShieldedInstanceConfig instance + */ + public static create(properties?: google.cloud.tpu.v2.IShieldedInstanceConfig): google.cloud.tpu.v2.ShieldedInstanceConfig; + + /** + * Encodes the specified ShieldedInstanceConfig message. Does not implicitly {@link google.cloud.tpu.v2.ShieldedInstanceConfig.verify|verify} messages. + * @param message ShieldedInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShieldedInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ShieldedInstanceConfig.verify|verify} messages. + * @param message ShieldedInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2.IShieldedInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShieldedInstanceConfig + * @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.cloud.tpu.v2.ShieldedInstanceConfig; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShieldedInstanceConfig + * @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.cloud.tpu.v2.ShieldedInstanceConfig; + + /** + * Verifies a ShieldedInstanceConfig 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 ShieldedInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShieldedInstanceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2.ShieldedInstanceConfig; + + /** + * Creates a plain object from a ShieldedInstanceConfig message. Also converts values to other types if specified. + * @param message ShieldedInstanceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2.ShieldedInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShieldedInstanceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShieldedInstanceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace v2alpha1. */ + namespace v2alpha1 { + + /** Represents a Tpu */ + class Tpu extends $protobuf.rpc.Service { + + /** + * Constructs a new Tpu service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Tpu service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Tpu; + + /** + * Calls ListNodes. + * @param request ListNodesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListNodesResponse + */ + public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback): void; + + /** + * Calls ListNodes. + * @param request ListNodesRequest message or plain object + * @returns Promise + */ + public listNodes(request: google.cloud.tpu.v2alpha1.IListNodesRequest): Promise; + + /** + * Calls GetNode. + * @param request GetNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Node + */ + public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback): void; + + /** + * Calls GetNode. + * @param request GetNodeRequest message or plain object + * @returns Promise + */ + public getNode(request: google.cloud.tpu.v2alpha1.IGetNodeRequest): Promise; + + /** + * Calls CreateNode. + * @param request CreateNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback): void; + + /** + * Calls CreateNode. + * @param request CreateNodeRequest message or plain object + * @returns Promise + */ + public createNode(request: google.cloud.tpu.v2alpha1.ICreateNodeRequest): Promise; + + /** + * Calls DeleteNode. + * @param request DeleteNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback): void; + + /** + * Calls DeleteNode. + * @param request DeleteNodeRequest message or plain object + * @returns Promise + */ + public deleteNode(request: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): Promise; + + /** + * Calls StopNode. + * @param request StopNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback): void; + + /** + * Calls StopNode. + * @param request StopNodeRequest message or plain object + * @returns Promise + */ + public stopNode(request: google.cloud.tpu.v2alpha1.IStopNodeRequest): Promise; + + /** + * Calls StartNode. + * @param request StartNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback): void; + + /** + * Calls StartNode. + * @param request StartNodeRequest message or plain object + * @returns Promise + */ + public startNode(request: google.cloud.tpu.v2alpha1.IStartNodeRequest): Promise; + + /** + * Calls UpdateNode. + * @param request UpdateNodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback): void; + + /** + * Calls UpdateNode. + * @param request UpdateNodeRequest message or plain object + * @returns Promise + */ + public updateNode(request: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): Promise; + + /** + * Calls ListQueuedResources. + * @param request ListQueuedResourcesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListQueuedResourcesResponse + */ + public listQueuedResources(request: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListQueuedResourcesCallback): void; + + /** + * Calls ListQueuedResources. + * @param request ListQueuedResourcesRequest message or plain object + * @returns Promise + */ + public listQueuedResources(request: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest): Promise; + + /** + * Calls GetQueuedResource. + * @param request GetQueuedResourceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QueuedResource + */ + public getQueuedResource(request: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetQueuedResourceCallback): void; + + /** + * Calls GetQueuedResource. + * @param request GetQueuedResourceRequest message or plain object + * @returns Promise + */ + public getQueuedResource(request: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest): Promise; + + /** + * Calls CreateQueuedResource. + * @param request CreateQueuedResourceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createQueuedResource(request: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, callback: google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResourceCallback): void; + + /** + * Calls CreateQueuedResource. + * @param request CreateQueuedResourceRequest message or plain object + * @returns Promise + */ + public createQueuedResource(request: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest): Promise; + + /** + * Calls DeleteQueuedResource. + * @param request DeleteQueuedResourceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteQueuedResource(request: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, callback: google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResourceCallback): void; + + /** + * Calls DeleteQueuedResource. + * @param request DeleteQueuedResourceRequest message or plain object + * @returns Promise + */ + public deleteQueuedResource(request: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest): Promise; + + /** + * Calls GenerateServiceIdentity. + * @param request GenerateServiceIdentityRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse + */ + public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback): void; + + /** + * Calls GenerateServiceIdentity. + * @param request GenerateServiceIdentityRequest message or plain object + * @returns Promise + */ + public generateServiceIdentity(request: google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest): Promise; + + /** + * Calls ListAcceleratorTypes. + * @param request ListAcceleratorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse + */ + public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback): void; + + /** + * Calls ListAcceleratorTypes. + * @param request ListAcceleratorTypesRequest message or plain object + * @returns Promise + */ + public listAcceleratorTypes(request: google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest): Promise; + + /** + * Calls GetAcceleratorType. + * @param request GetAcceleratorTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AcceleratorType + */ + public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback): void; + + /** + * Calls GetAcceleratorType. + * @param request GetAcceleratorTypeRequest message or plain object + * @returns Promise + */ + public getAcceleratorType(request: google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest): Promise; + + /** + * Calls ListRuntimeVersions. + * @param request ListRuntimeVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse + */ + public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest, callback: google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback): void; + + /** + * Calls ListRuntimeVersions. + * @param request ListRuntimeVersionsRequest message or plain object + * @returns Promise + */ + public listRuntimeVersions(request: google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest): Promise; + + /** + * Calls GetRuntimeVersion. + * @param request GetRuntimeVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RuntimeVersion + */ + public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback): void; + + /** + * Calls GetRuntimeVersion. + * @param request GetRuntimeVersionRequest message or plain object + * @returns Promise + */ + public getRuntimeVersion(request: google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest): Promise; + + /** + * Calls GetGuestAttributes. + * @param request GetGuestAttributesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetGuestAttributesResponse + */ + public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest, callback: google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback): void; + + /** + * Calls GetGuestAttributes. + * @param request GetGuestAttributesRequest message or plain object + * @returns Promise + */ + public getGuestAttributes(request: google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest): Promise; + + /** + * Calls SimulateMaintenanceEvent. + * @param request SimulateMaintenanceEventRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public simulateMaintenanceEvent(request: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, callback: google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEventCallback): void; + + /** + * Calls SimulateMaintenanceEvent. + * @param request SimulateMaintenanceEventRequest message or plain object + * @returns Promise + */ + public simulateMaintenanceEvent(request: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest): Promise; + } + + namespace Tpu { + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listNodes}. + * @param error Error, if any + * @param [response] ListNodesResponse + */ + type ListNodesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListNodesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getNode}. + * @param error Error, if any + * @param [response] Node + */ + type GetNodeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.Node) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createNode}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteNode}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|stopNode}. + * @param error Error, if any + * @param [response] Operation + */ + type StopNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|startNode}. + * @param error Error, if any + * @param [response] Operation + */ + type StartNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|updateNode}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateNodeCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listQueuedResources}. + * @param error Error, if any + * @param [response] ListQueuedResourcesResponse + */ + type ListQueuedResourcesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getQueuedResource}. + * @param error Error, if any + * @param [response] QueuedResource + */ + type GetQueuedResourceCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.QueuedResource) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createQueuedResource}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateQueuedResourceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteQueuedResource}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteQueuedResourceCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. + * @param error Error, if any + * @param [response] GenerateServiceIdentityResponse + */ + type GenerateServiceIdentityCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listAcceleratorTypes}. + * @param error Error, if any + * @param [response] ListAcceleratorTypesResponse + */ + type ListAcceleratorTypesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getAcceleratorType}. + * @param error Error, if any + * @param [response] AcceleratorType + */ + type GetAcceleratorTypeCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.AcceleratorType) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listRuntimeVersions}. + * @param error Error, if any + * @param [response] ListRuntimeVersionsResponse + */ + type ListRuntimeVersionsCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getRuntimeVersion}. + * @param error Error, if any + * @param [response] RuntimeVersion + */ + type GetRuntimeVersionCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.RuntimeVersion) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getGuestAttributes}. + * @param error Error, if any + * @param [response] GetGuestAttributesResponse + */ + type GetGuestAttributesCallback = (error: (Error|null), response?: google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) => void; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|simulateMaintenanceEvent}. + * @param error Error, if any + * @param [response] Operation + */ + type SimulateMaintenanceEventCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a GuestAttributes. */ + interface IGuestAttributes { + + /** GuestAttributes queryPath */ + queryPath?: (string|null); + + /** GuestAttributes queryValue */ + queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + } + + /** Represents a GuestAttributes. */ + class GuestAttributes implements IGuestAttributes { + + /** + * Constructs a new GuestAttributes. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes); + + /** GuestAttributes queryPath. */ + public queryPath: string; + + /** GuestAttributes queryValue. */ + public queryValue?: (google.cloud.tpu.v2alpha1.IGuestAttributesValue|null); + + /** + * Creates a new GuestAttributes instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributes instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributes): google.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @param message GuestAttributes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @param message GuestAttributes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributes + * @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.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributes + * @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.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Verifies a GuestAttributes 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 GuestAttributes message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributes + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributes; + + /** + * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. + * @param message GuestAttributes + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributes, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributes to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GuestAttributes + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GuestAttributesValue. */ + interface IGuestAttributesValue { + + /** GuestAttributesValue items */ + items?: (google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]|null); + } + + /** Represents a GuestAttributesValue. */ + class GuestAttributesValue implements IGuestAttributesValue { + + /** + * Constructs a new GuestAttributesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue); + + /** GuestAttributesValue items. */ + public items: google.cloud.tpu.v2alpha1.IGuestAttributesEntry[]; + + /** + * Creates a new GuestAttributesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributesValue instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesValue): google.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @param message GuestAttributesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @param message GuestAttributesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributesValue + * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributesValue + * @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.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Verifies a GuestAttributesValue 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 GuestAttributesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributesValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesValue; + + /** + * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. + * @param message GuestAttributesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GuestAttributesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GuestAttributesEntry. */ + interface IGuestAttributesEntry { + + /** GuestAttributesEntry namespace */ + namespace?: (string|null); + + /** GuestAttributesEntry key */ + key?: (string|null); + + /** GuestAttributesEntry value */ + value?: (string|null); + } + + /** Represents a GuestAttributesEntry. */ + class GuestAttributesEntry implements IGuestAttributesEntry { + + /** + * Constructs a new GuestAttributesEntry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry); + + /** GuestAttributesEntry namespace. */ + public namespace: string; + + /** GuestAttributesEntry key. */ + public key: string; + + /** GuestAttributesEntry value. */ + public value: string; + + /** + * Creates a new GuestAttributesEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns GuestAttributesEntry instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGuestAttributesEntry): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @param message GuestAttributesEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @param message GuestAttributesEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGuestAttributesEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GuestAttributesEntry + * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GuestAttributesEntry + * @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.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Verifies a GuestAttributesEntry 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 GuestAttributesEntry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GuestAttributesEntry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GuestAttributesEntry; + + /** + * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. + * @param message GuestAttributesEntry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GuestAttributesEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GuestAttributesEntry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GuestAttributesEntry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AttachedDisk. */ + interface IAttachedDisk { + + /** AttachedDisk sourceDisk */ + sourceDisk?: (string|null); + + /** AttachedDisk mode */ + mode?: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null); + } + + /** Represents an AttachedDisk. */ + class AttachedDisk implements IAttachedDisk { + + /** + * Constructs a new AttachedDisk. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk); + + /** AttachedDisk sourceDisk. */ + public sourceDisk: string; + + /** AttachedDisk mode. */ + public mode: (google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|keyof typeof google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode); + + /** + * Creates a new AttachedDisk instance using the specified properties. + * @param [properties] Properties to set + * @returns AttachedDisk instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAttachedDisk): google.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @param message AttachedDisk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @param message AttachedDisk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAttachedDisk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AttachedDisk + * @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.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AttachedDisk + * @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.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Verifies an AttachedDisk 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 an AttachedDisk message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AttachedDisk + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AttachedDisk; + + /** + * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. + * @param message AttachedDisk + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AttachedDisk, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AttachedDisk to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AttachedDisk + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AttachedDisk { + + /** DiskMode enum. */ + enum DiskMode { + DISK_MODE_UNSPECIFIED = 0, + READ_WRITE = 1, + READ_ONLY = 2 + } + } + + /** Properties of a SchedulingConfig. */ + interface ISchedulingConfig { + + /** SchedulingConfig preemptible */ + preemptible?: (boolean|null); + + /** SchedulingConfig reserved */ + reserved?: (boolean|null); + } + + /** Represents a SchedulingConfig. */ + class SchedulingConfig implements ISchedulingConfig { + + /** + * Constructs a new SchedulingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig); + + /** SchedulingConfig preemptible. */ + public preemptible: boolean; + + /** SchedulingConfig reserved. */ + public reserved: boolean; + + /** + * Creates a new SchedulingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SchedulingConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ISchedulingConfig): google.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @param message SchedulingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @param message SchedulingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ISchedulingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SchedulingConfig + * @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.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SchedulingConfig + * @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.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Verifies a SchedulingConfig 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 SchedulingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SchedulingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.SchedulingConfig; + + /** + * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. + * @param message SchedulingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.SchedulingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SchedulingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SchedulingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a NetworkEndpoint. */ + interface INetworkEndpoint { + + /** NetworkEndpoint ipAddress */ + ipAddress?: (string|null); + + /** NetworkEndpoint port */ + port?: (number|null); + + /** NetworkEndpoint accessConfig */ + accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + } + + /** Represents a NetworkEndpoint. */ + class NetworkEndpoint implements INetworkEndpoint { + + /** + * Constructs a new NetworkEndpoint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint); + + /** NetworkEndpoint ipAddress. */ + public ipAddress: string; + + /** NetworkEndpoint port. */ + public port: number; + + /** NetworkEndpoint accessConfig. */ + public accessConfig?: (google.cloud.tpu.v2alpha1.IAccessConfig|null); + + /** + * Creates a new NetworkEndpoint instance using the specified properties. + * @param [properties] Properties to set + * @returns NetworkEndpoint instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INetworkEndpoint): google.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @param message NetworkEndpoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @param message NetworkEndpoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkEndpoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NetworkEndpoint + * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NetworkEndpoint + * @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.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Verifies a NetworkEndpoint 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 NetworkEndpoint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NetworkEndpoint + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkEndpoint; + + /** + * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. + * @param message NetworkEndpoint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.NetworkEndpoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NetworkEndpoint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NetworkEndpoint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AccessConfig. */ + interface IAccessConfig { + + /** AccessConfig externalIp */ + externalIp?: (string|null); + } + + /** Represents an AccessConfig. */ + class AccessConfig implements IAccessConfig { + + /** + * Constructs a new AccessConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IAccessConfig); + + /** AccessConfig externalIp. */ + public externalIp: string; + + /** + * Creates a new AccessConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AccessConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IAccessConfig): google.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @param message AccessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @param message AccessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IAccessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AccessConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AccessConfig + * @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.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Decodes an AccessConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AccessConfig + * @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.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Verifies an AccessConfig 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 an AccessConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AccessConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.AccessConfig; + + /** + * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. + * @param message AccessConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.AccessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AccessConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AccessConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a NetworkConfig. */ + interface INetworkConfig { + + /** NetworkConfig network */ + network?: (string|null); + + /** NetworkConfig subnetwork */ + subnetwork?: (string|null); + + /** NetworkConfig enableExternalIps */ + enableExternalIps?: (boolean|null); + + /** NetworkConfig canIpForward */ + canIpForward?: (boolean|null); + } + + /** Represents a NetworkConfig. */ + class NetworkConfig implements INetworkConfig { + + /** + * Constructs a new NetworkConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INetworkConfig); + + /** NetworkConfig network. */ + public network: string; + + /** NetworkConfig subnetwork. */ + public subnetwork: string; + + /** NetworkConfig enableExternalIps. */ + public enableExternalIps: boolean; + + /** NetworkConfig canIpForward. */ + public canIpForward: boolean; + + /** + * Creates a new NetworkConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns NetworkConfig instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INetworkConfig): google.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @param message NetworkConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @param message NetworkConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INetworkConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NetworkConfig + * @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.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NetworkConfig + * @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.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Verifies a NetworkConfig 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 NetworkConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NetworkConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.NetworkConfig; + + /** + * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. + * @param message NetworkConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.NetworkConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NetworkConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NetworkConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceAccount. */ + interface IServiceAccount { + + /** ServiceAccount email */ + email?: (string|null); + + /** ServiceAccount scope */ + scope?: (string[]|null); + } + + /** Represents a ServiceAccount. */ + class ServiceAccount implements IServiceAccount { + + /** + * Constructs a new ServiceAccount. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IServiceAccount); + + /** ServiceAccount email. */ + public email: string; + + /** ServiceAccount scope. */ + public scope: string[]; + + /** + * Creates a new ServiceAccount instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceAccount instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IServiceAccount): google.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @param message ServiceAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @param message ServiceAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IServiceAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceAccount + * @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.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceAccount + * @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.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Verifies a ServiceAccount 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 ServiceAccount message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceAccount + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ServiceAccount; + + /** + * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. + * @param message ServiceAccount + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ServiceAccount, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceAccount to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceAccount + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Node. */ + interface INode { + + /** Node name */ + name?: (string|null); + + /** Node description */ + description?: (string|null); + + /** Node acceleratorType */ + acceleratorType?: (string|null); + + /** Node state */ + state?: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State|null); + + /** Node healthDescription */ + healthDescription?: (string|null); + + /** Node runtimeVersion */ + runtimeVersion?: (string|null); + + /** Node networkConfig */ + networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + + /** Node cidrBlock */ + cidrBlock?: (string|null); + + /** Node serviceAccount */ + serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + + /** Node createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Node schedulingConfig */ + schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + + /** Node networkEndpoints */ + networkEndpoints?: (google.cloud.tpu.v2alpha1.INetworkEndpoint[]|null); + + /** Node health */ + health?: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health|null); + + /** Node labels */ + labels?: ({ [k: string]: string }|null); + + /** Node metadata */ + metadata?: ({ [k: string]: string }|null); + + /** Node tags */ + tags?: (string[]|null); + + /** Node id */ + id?: (number|Long|string|null); + + /** Node dataDisks */ + dataDisks?: (google.cloud.tpu.v2alpha1.IAttachedDisk[]|null); + + /** Node apiVersion */ + apiVersion?: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion|null); + + /** Node symptoms */ + symptoms?: (google.cloud.tpu.v2alpha1.ISymptom[]|null); + + /** Node queuedResource */ + queuedResource?: (string|null); + + /** Node shieldedInstanceConfig */ + shieldedInstanceConfig?: (google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null); + } + + /** Represents a Node. */ + class Node implements INode { + + /** + * Constructs a new Node. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.INode); + + /** Node name. */ + public name: string; + + /** Node description. */ + public description: string; + + /** Node acceleratorType. */ + public acceleratorType: string; + + /** Node state. */ + public state: (google.cloud.tpu.v2alpha1.Node.State|keyof typeof google.cloud.tpu.v2alpha1.Node.State); + + /** Node healthDescription. */ + public healthDescription: string; + + /** Node runtimeVersion. */ + public runtimeVersion: string; + + /** Node networkConfig. */ + public networkConfig?: (google.cloud.tpu.v2alpha1.INetworkConfig|null); + + /** Node cidrBlock. */ + public cidrBlock: string; + + /** Node serviceAccount. */ + public serviceAccount?: (google.cloud.tpu.v2alpha1.IServiceAccount|null); + + /** Node createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Node schedulingConfig. */ + public schedulingConfig?: (google.cloud.tpu.v2alpha1.ISchedulingConfig|null); + + /** Node networkEndpoints. */ + public networkEndpoints: google.cloud.tpu.v2alpha1.INetworkEndpoint[]; + + /** Node health. */ + public health: (google.cloud.tpu.v2alpha1.Node.Health|keyof typeof google.cloud.tpu.v2alpha1.Node.Health); + + /** Node labels. */ + public labels: { [k: string]: string }; + + /** Node metadata. */ + public metadata: { [k: string]: string }; + + /** Node tags. */ + public tags: string[]; + + /** Node id. */ + public id: (number|Long|string); + + /** Node dataDisks. */ + public dataDisks: google.cloud.tpu.v2alpha1.IAttachedDisk[]; + + /** Node apiVersion. */ + public apiVersion: (google.cloud.tpu.v2alpha1.Node.ApiVersion|keyof typeof google.cloud.tpu.v2alpha1.Node.ApiVersion); + + /** Node symptoms. */ + public symptoms: google.cloud.tpu.v2alpha1.ISymptom[]; + + /** Node queuedResource. */ + public queuedResource: string; + + /** Node shieldedInstanceConfig. */ + public shieldedInstanceConfig?: (google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null); + + /** + * Creates a new Node instance using the specified properties. + * @param [properties] Properties to set + * @returns Node instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.INode): google.cloud.tpu.v2alpha1.Node; + + /** + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @param message Node message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @param message Node message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.INode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Node message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Node + * @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.cloud.tpu.v2alpha1.Node; + + /** + * Decodes a Node message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Node + * @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.cloud.tpu.v2alpha1.Node; + + /** + * Verifies a Node 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 Node message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Node + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.Node; + + /** + * Creates a plain object from a Node message. Also converts values to other types if specified. + * @param message Node + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.Node, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Node to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Node + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Node { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + READY = 2, + RESTARTING = 3, + REIMAGING = 4, + DELETING = 5, + REPAIRING = 6, + STOPPED = 8, + STOPPING = 9, + STARTING = 10, + PREEMPTED = 11, + TERMINATED = 12, + HIDING = 13, + HIDDEN = 14, + UNHIDING = 15 + } + + /** Health enum. */ + enum Health { + HEALTH_UNSPECIFIED = 0, + HEALTHY = 1, + TIMEOUT = 3, + UNHEALTHY_TENSORFLOW = 4, + UNHEALTHY_MAINTENANCE = 5 + } + + /** ApiVersion enum. */ + enum ApiVersion { + API_VERSION_UNSPECIFIED = 0, + V1_ALPHA1 = 1, + V1 = 2, + V2_ALPHA1 = 3 + } + } + + /** Properties of a QueuedResource. */ + interface IQueuedResource { + + /** QueuedResource name */ + name?: (string|null); + + /** QueuedResource tpu */ + tpu?: (google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null); + + /** QueuedResource bestEffort */ + bestEffort?: (google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort|null); + + /** QueuedResource guaranteed */ + guaranteed?: (google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed|null); + + /** QueuedResource queueingPolicy */ + queueingPolicy?: (google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy|null); + + /** QueuedResource state */ + state?: (google.cloud.tpu.v2alpha1.IQueuedResourceState|null); + } + + /** Represents a QueuedResource. */ + class QueuedResource implements IQueuedResource { + + /** + * Constructs a new QueuedResource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IQueuedResource); + + /** QueuedResource name. */ + public name: string; + + /** QueuedResource tpu. */ + public tpu?: (google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null); + + /** QueuedResource bestEffort. */ + public bestEffort?: (google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort|null); + + /** QueuedResource guaranteed. */ + public guaranteed?: (google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed|null); + + /** QueuedResource queueingPolicy. */ + public queueingPolicy?: (google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy|null); + + /** QueuedResource state. */ + public state?: (google.cloud.tpu.v2alpha1.IQueuedResourceState|null); + + /** QueuedResource resource. */ + public resource?: "tpu"; + + /** QueuedResource tier. */ + public tier?: ("bestEffort"|"guaranteed"); + + /** + * Creates a new QueuedResource instance using the specified properties. + * @param [properties] Properties to set + * @returns QueuedResource instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IQueuedResource): google.cloud.tpu.v2alpha1.QueuedResource; + + /** + * Encodes the specified QueuedResource message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.verify|verify} messages. + * @param message QueuedResource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IQueuedResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueuedResource message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.verify|verify} messages. + * @param message QueuedResource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IQueuedResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueuedResource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueuedResource + * @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.cloud.tpu.v2alpha1.QueuedResource; + + /** + * Decodes a QueuedResource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueuedResource + * @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.cloud.tpu.v2alpha1.QueuedResource; + + /** + * Verifies a QueuedResource 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 QueuedResource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueuedResource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource; + + /** + * Creates a plain object from a QueuedResource message. Also converts values to other types if specified. + * @param message QueuedResource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueuedResource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueuedResource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QueuedResource { + + /** Properties of a Tpu. */ + interface ITpu { + + /** Tpu nodeSpec */ + nodeSpec?: (google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec[]|null); + } + + /** Represents a Tpu. */ + class Tpu implements ITpu { + + /** + * Constructs a new Tpu. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResource.ITpu); + + /** Tpu nodeSpec. */ + public nodeSpec: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec[]; + + /** + * Creates a new Tpu instance using the specified properties. + * @param [properties] Properties to set + * @returns Tpu instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResource.ITpu): google.cloud.tpu.v2alpha1.QueuedResource.Tpu; + + /** + * Encodes the specified Tpu message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.verify|verify} messages. + * @param message Tpu message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResource.ITpu, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Tpu message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.verify|verify} messages. + * @param message Tpu message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResource.ITpu, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Tpu message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Tpu + * @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.cloud.tpu.v2alpha1.QueuedResource.Tpu; + + /** + * Decodes a Tpu message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Tpu + * @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.cloud.tpu.v2alpha1.QueuedResource.Tpu; + + /** + * Verifies a Tpu 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 Tpu message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Tpu + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource.Tpu; + + /** + * Creates a plain object from a Tpu message. Also converts values to other types if specified. + * @param message Tpu + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource.Tpu, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Tpu to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Tpu + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Tpu { + + /** Properties of a NodeSpec. */ + interface INodeSpec { + + /** NodeSpec parent */ + parent?: (string|null); + + /** NodeSpec nodeId */ + nodeId?: (string|null); + + /** NodeSpec node */ + node?: (google.cloud.tpu.v2alpha1.INode|null); + } + + /** Represents a NodeSpec. */ + class NodeSpec implements INodeSpec { + + /** + * Constructs a new NodeSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec); + + /** NodeSpec parent. */ + public parent: string; + + /** NodeSpec nodeId. */ + public nodeId: string; + + /** NodeSpec node. */ + public node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** + * Creates a new NodeSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns NodeSpec instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec): google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec; + + /** + * Encodes the specified NodeSpec message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.verify|verify} messages. + * @param message NodeSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NodeSpec message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.verify|verify} messages. + * @param message NodeSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NodeSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NodeSpec + * @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.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec; + + /** + * Decodes a NodeSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NodeSpec + * @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.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec; + + /** + * Verifies a NodeSpec 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 NodeSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NodeSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec; + + /** + * Creates a plain object from a NodeSpec message. Also converts values to other types if specified. + * @param message NodeSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NodeSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NodeSpec + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a BestEffort. */ + interface IBestEffort { + } + + /** Represents a BestEffort. */ + class BestEffort implements IBestEffort { + + /** + * Constructs a new BestEffort. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort); + + /** + * Creates a new BestEffort instance using the specified properties. + * @param [properties] Properties to set + * @returns BestEffort instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort): google.cloud.tpu.v2alpha1.QueuedResource.BestEffort; + + /** + * Encodes the specified BestEffort message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.verify|verify} messages. + * @param message BestEffort message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BestEffort message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.verify|verify} messages. + * @param message BestEffort message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BestEffort message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BestEffort + * @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.cloud.tpu.v2alpha1.QueuedResource.BestEffort; + + /** + * Decodes a BestEffort message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BestEffort + * @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.cloud.tpu.v2alpha1.QueuedResource.BestEffort; + + /** + * Verifies a BestEffort 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 BestEffort message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BestEffort + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource.BestEffort; + + /** + * Creates a plain object from a BestEffort message. Also converts values to other types if specified. + * @param message BestEffort + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource.BestEffort, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BestEffort to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BestEffort + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Guaranteed. */ + interface IGuaranteed { + + /** Guaranteed minDuration */ + minDuration?: (google.protobuf.IDuration|null); + + /** Guaranteed reserved */ + reserved?: (boolean|null); + } + + /** Represents a Guaranteed. */ + class Guaranteed implements IGuaranteed { + + /** + * Constructs a new Guaranteed. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed); + + /** Guaranteed minDuration. */ + public minDuration?: (google.protobuf.IDuration|null); + + /** Guaranteed reserved. */ + public reserved: boolean; + + /** + * Creates a new Guaranteed instance using the specified properties. + * @param [properties] Properties to set + * @returns Guaranteed instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed): google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed; + + /** + * Encodes the specified Guaranteed message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.verify|verify} messages. + * @param message Guaranteed message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Guaranteed message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.verify|verify} messages. + * @param message Guaranteed message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Guaranteed message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Guaranteed + * @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.cloud.tpu.v2alpha1.QueuedResource.Guaranteed; + + /** + * Decodes a Guaranteed message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Guaranteed + * @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.cloud.tpu.v2alpha1.QueuedResource.Guaranteed; + + /** + * Verifies a Guaranteed 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 Guaranteed message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Guaranteed + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed; + + /** + * Creates a plain object from a Guaranteed message. Also converts values to other types if specified. + * @param message Guaranteed + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Guaranteed to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Guaranteed + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueueingPolicy. */ + interface IQueueingPolicy { + + /** QueueingPolicy validUntilDuration */ + validUntilDuration?: (google.protobuf.IDuration|null); + + /** QueueingPolicy validUntilTime */ + validUntilTime?: (google.protobuf.ITimestamp|null); + + /** QueueingPolicy validAfterDuration */ + validAfterDuration?: (google.protobuf.IDuration|null); + + /** QueueingPolicy validAfterTime */ + validAfterTime?: (google.protobuf.ITimestamp|null); + + /** QueueingPolicy validInterval */ + validInterval?: (google.type.IInterval|null); + } + + /** Represents a QueueingPolicy. */ + class QueueingPolicy implements IQueueingPolicy { + + /** + * Constructs a new QueueingPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy); + + /** QueueingPolicy validUntilDuration. */ + public validUntilDuration?: (google.protobuf.IDuration|null); + + /** QueueingPolicy validUntilTime. */ + public validUntilTime?: (google.protobuf.ITimestamp|null); + + /** QueueingPolicy validAfterDuration. */ + public validAfterDuration?: (google.protobuf.IDuration|null); + + /** QueueingPolicy validAfterTime. */ + public validAfterTime?: (google.protobuf.ITimestamp|null); + + /** QueueingPolicy validInterval. */ + public validInterval?: (google.type.IInterval|null); + + /** QueueingPolicy startTimingConstraints. */ + public startTimingConstraints?: ("validUntilDuration"|"validUntilTime"|"validAfterDuration"|"validAfterTime"|"validInterval"); + + /** + * Creates a new QueueingPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns QueueingPolicy instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy): google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy; + + /** + * Encodes the specified QueueingPolicy message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.verify|verify} messages. + * @param message QueueingPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueueingPolicy message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.verify|verify} messages. + * @param message QueueingPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueueingPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueueingPolicy + * @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.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy; + + /** + * Decodes a QueueingPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueueingPolicy + * @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.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy; + + /** + * Verifies a QueueingPolicy 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 QueueingPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueueingPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy; + + /** + * Creates a plain object from a QueueingPolicy message. Also converts values to other types if specified. + * @param message QueueingPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueueingPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueueingPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a QueuedResourceState. */ + interface IQueuedResourceState { + + /** QueuedResourceState state */ + state?: (google.cloud.tpu.v2alpha1.QueuedResourceState.State|keyof typeof google.cloud.tpu.v2alpha1.QueuedResourceState.State|null); + + /** QueuedResourceState creatingData */ + creatingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData|null); + + /** QueuedResourceState acceptedData */ + acceptedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData|null); + + /** QueuedResourceState provisioningData */ + provisioningData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData|null); + + /** QueuedResourceState failedData */ + failedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData|null); + + /** QueuedResourceState deletingData */ + deletingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData|null); + + /** QueuedResourceState activeData */ + activeData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData|null); + + /** QueuedResourceState suspendingData */ + suspendingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData|null); + + /** QueuedResourceState suspendedData */ + suspendedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData|null); + } + + /** Represents a QueuedResourceState. */ + class QueuedResourceState implements IQueuedResourceState { + + /** + * Constructs a new QueuedResourceState. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IQueuedResourceState); + + /** QueuedResourceState state. */ + public state: (google.cloud.tpu.v2alpha1.QueuedResourceState.State|keyof typeof google.cloud.tpu.v2alpha1.QueuedResourceState.State); + + /** QueuedResourceState creatingData. */ + public creatingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData|null); + + /** QueuedResourceState acceptedData. */ + public acceptedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData|null); + + /** QueuedResourceState provisioningData. */ + public provisioningData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData|null); + + /** QueuedResourceState failedData. */ + public failedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData|null); + + /** QueuedResourceState deletingData. */ + public deletingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData|null); + + /** QueuedResourceState activeData. */ + public activeData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData|null); + + /** QueuedResourceState suspendingData. */ + public suspendingData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData|null); + + /** QueuedResourceState suspendedData. */ + public suspendedData?: (google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData|null); + + /** QueuedResourceState stateData. */ + public stateData?: ("creatingData"|"acceptedData"|"provisioningData"|"failedData"|"deletingData"|"activeData"|"suspendingData"|"suspendedData"); + + /** + * Creates a new QueuedResourceState instance using the specified properties. + * @param [properties] Properties to set + * @returns QueuedResourceState instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IQueuedResourceState): google.cloud.tpu.v2alpha1.QueuedResourceState; + + /** + * Encodes the specified QueuedResourceState message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.verify|verify} messages. + * @param message QueuedResourceState message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IQueuedResourceState, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueuedResourceState message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.verify|verify} messages. + * @param message QueuedResourceState message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IQueuedResourceState, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueuedResourceState message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueuedResourceState + * @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.cloud.tpu.v2alpha1.QueuedResourceState; + + /** + * Decodes a QueuedResourceState message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueuedResourceState + * @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.cloud.tpu.v2alpha1.QueuedResourceState; + + /** + * Verifies a QueuedResourceState 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 QueuedResourceState message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueuedResourceState + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState; + + /** + * Creates a plain object from a QueuedResourceState message. Also converts values to other types if specified. + * @param message QueuedResourceState + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueuedResourceState to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueuedResourceState + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QueuedResourceState { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + ACCEPTED = 2, + PROVISIONING = 3, + FAILED = 4, + DELETING = 5, + ACTIVE = 6, + SUSPENDING = 7, + SUSPENDED = 8 + } + + /** Properties of a CreatingData. */ + interface ICreatingData { + } + + /** Represents a CreatingData. */ + class CreatingData implements ICreatingData { + + /** + * Constructs a new CreatingData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData); + + /** + * Creates a new CreatingData instance using the specified properties. + * @param [properties] Properties to set + * @returns CreatingData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData): google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData; + + /** + * Encodes the specified CreatingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.verify|verify} messages. + * @param message CreatingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreatingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.verify|verify} messages. + * @param message CreatingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreatingData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreatingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData; + + /** + * Decodes a CreatingData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreatingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData; + + /** + * Verifies a CreatingData 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 CreatingData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreatingData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData; + + /** + * Creates a plain object from a CreatingData message. Also converts values to other types if specified. + * @param message CreatingData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreatingData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreatingData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AcceptedData. */ + interface IAcceptedData { + } + + /** Represents an AcceptedData. */ + class AcceptedData implements IAcceptedData { + + /** + * Constructs a new AcceptedData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData); + + /** + * Creates a new AcceptedData instance using the specified properties. + * @param [properties] Properties to set + * @returns AcceptedData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData): google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData; + + /** + * Encodes the specified AcceptedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.verify|verify} messages. + * @param message AcceptedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcceptedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.verify|verify} messages. + * @param message AcceptedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcceptedData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcceptedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData; + + /** + * Decodes an AcceptedData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcceptedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData; + + /** + * Verifies an AcceptedData 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 an AcceptedData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcceptedData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData; + + /** + * Creates a plain object from an AcceptedData message. Also converts values to other types if specified. + * @param message AcceptedData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcceptedData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AcceptedData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ProvisioningData. */ + interface IProvisioningData { + } + + /** Represents a ProvisioningData. */ + class ProvisioningData implements IProvisioningData { + + /** + * Constructs a new ProvisioningData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData); + + /** + * Creates a new ProvisioningData instance using the specified properties. + * @param [properties] Properties to set + * @returns ProvisioningData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData): google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData; + + /** + * Encodes the specified ProvisioningData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.verify|verify} messages. + * @param message ProvisioningData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProvisioningData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.verify|verify} messages. + * @param message ProvisioningData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProvisioningData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProvisioningData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData; + + /** + * Decodes a ProvisioningData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProvisioningData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData; + + /** + * Verifies a ProvisioningData 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 ProvisioningData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProvisioningData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData; + + /** + * Creates a plain object from a ProvisioningData message. Also converts values to other types if specified. + * @param message ProvisioningData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProvisioningData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProvisioningData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FailedData. */ + interface IFailedData { + + /** FailedData error */ + error?: (google.rpc.IStatus|null); + } + + /** Represents a FailedData. */ + class FailedData implements IFailedData { + + /** + * Constructs a new FailedData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData); + + /** FailedData error. */ + public error?: (google.rpc.IStatus|null); + + /** + * Creates a new FailedData instance using the specified properties. + * @param [properties] Properties to set + * @returns FailedData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData): google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData; + + /** + * Encodes the specified FailedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.verify|verify} messages. + * @param message FailedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FailedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.verify|verify} messages. + * @param message FailedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FailedData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FailedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.FailedData; + + /** + * Decodes a FailedData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FailedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.FailedData; + + /** + * Verifies a FailedData 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 FailedData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FailedData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData; + + /** + * Creates a plain object from a FailedData message. Also converts values to other types if specified. + * @param message FailedData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FailedData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FailedData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeletingData. */ + interface IDeletingData { + } + + /** Represents a DeletingData. */ + class DeletingData implements IDeletingData { + + /** + * Constructs a new DeletingData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData); + + /** + * Creates a new DeletingData instance using the specified properties. + * @param [properties] Properties to set + * @returns DeletingData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData): google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData; + + /** + * Encodes the specified DeletingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.verify|verify} messages. + * @param message DeletingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeletingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.verify|verify} messages. + * @param message DeletingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeletingData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeletingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData; + + /** + * Decodes a DeletingData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeletingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData; + + /** + * Verifies a DeletingData 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 DeletingData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeletingData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData; + + /** + * Creates a plain object from a DeletingData message. Also converts values to other types if specified. + * @param message DeletingData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeletingData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeletingData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ActiveData. */ + interface IActiveData { + } + + /** Represents an ActiveData. */ + class ActiveData implements IActiveData { + + /** + * Constructs a new ActiveData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData); + + /** + * Creates a new ActiveData instance using the specified properties. + * @param [properties] Properties to set + * @returns ActiveData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData): google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData; + + /** + * Encodes the specified ActiveData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.verify|verify} messages. + * @param message ActiveData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ActiveData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.verify|verify} messages. + * @param message ActiveData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ActiveData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ActiveData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData; + + /** + * Decodes an ActiveData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ActiveData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData; + + /** + * Verifies an ActiveData 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 an ActiveData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ActiveData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData; + + /** + * Creates a plain object from an ActiveData message. Also converts values to other types if specified. + * @param message ActiveData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ActiveData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ActiveData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuspendingData. */ + interface ISuspendingData { + } + + /** Represents a SuspendingData. */ + class SuspendingData implements ISuspendingData { + + /** + * Constructs a new SuspendingData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData); + + /** + * Creates a new SuspendingData instance using the specified properties. + * @param [properties] Properties to set + * @returns SuspendingData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData): google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData; + + /** + * Encodes the specified SuspendingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.verify|verify} messages. + * @param message SuspendingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuspendingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.verify|verify} messages. + * @param message SuspendingData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuspendingData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuspendingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData; + + /** + * Decodes a SuspendingData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuspendingData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData; + + /** + * Verifies a SuspendingData 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 SuspendingData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuspendingData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData; + + /** + * Creates a plain object from a SuspendingData message. Also converts values to other types if specified. + * @param message SuspendingData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuspendingData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuspendingData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuspendedData. */ + interface ISuspendedData { + } + + /** Represents a SuspendedData. */ + class SuspendedData implements ISuspendedData { + + /** + * Constructs a new SuspendedData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData); + + /** + * Creates a new SuspendedData instance using the specified properties. + * @param [properties] Properties to set + * @returns SuspendedData instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData): google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData; + + /** + * Encodes the specified SuspendedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.verify|verify} messages. + * @param message SuspendedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuspendedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.verify|verify} messages. + * @param message SuspendedData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuspendedData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuspendedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData; + + /** + * Decodes a SuspendedData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuspendedData + * @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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData; + + /** + * Verifies a SuspendedData 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 SuspendedData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuspendedData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData; + + /** + * Creates a plain object from a SuspendedData message. Also converts values to other types if specified. + * @param message SuspendedData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuspendedData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuspendedData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListNodesRequest. */ + interface IListNodesRequest { + + /** ListNodesRequest parent */ + parent?: (string|null); + + /** ListNodesRequest pageSize */ + pageSize?: (number|null); + + /** ListNodesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListNodesRequest. */ + class ListNodesRequest implements IListNodesRequest { + + /** + * Constructs a new ListNodesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest); + + /** ListNodesRequest parent. */ + public parent: string; + + /** ListNodesRequest pageSize. */ + public pageSize: number; + + /** ListNodesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListNodesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNodesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesRequest): google.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @param message ListNodesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @param message ListNodesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNodesRequest + * @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.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNodesRequest + * @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.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Verifies a ListNodesRequest 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 ListNodesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNodesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesRequest; + + /** + * Creates a plain object from a ListNodesRequest message. Also converts values to other types if specified. + * @param message ListNodesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNodesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNodesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListNodesResponse. */ + interface IListNodesResponse { + + /** ListNodesResponse nodes */ + nodes?: (google.cloud.tpu.v2alpha1.INode[]|null); + + /** ListNodesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListNodesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListNodesResponse. */ + class ListNodesResponse implements IListNodesResponse { + + /** + * Constructs a new ListNodesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse); + + /** ListNodesResponse nodes. */ + public nodes: google.cloud.tpu.v2alpha1.INode[]; + + /** ListNodesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListNodesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListNodesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNodesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListNodesResponse): google.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @param message ListNodesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @param message ListNodesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListNodesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNodesResponse + * @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.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNodesResponse + * @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.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Verifies a ListNodesResponse 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 ListNodesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNodesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListNodesResponse; + + /** + * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. + * @param message ListNodesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListNodesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNodesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNodesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetNodeRequest. */ + interface IGetNodeRequest { + + /** GetNodeRequest name */ + name?: (string|null); + } + + /** Represents a GetNodeRequest. */ + class GetNodeRequest implements IGetNodeRequest { + + /** + * Constructs a new GetNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest); + + /** GetNodeRequest name. */ + public name: string; + + /** + * Creates a new GetNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetNodeRequest): google.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @param message GetNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @param message GetNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNodeRequest + * @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.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNodeRequest + * @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.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Verifies a GetNodeRequest 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 GetNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetNodeRequest; + + /** + * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. + * @param message GetNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateNodeRequest. */ + interface ICreateNodeRequest { + + /** CreateNodeRequest parent */ + parent?: (string|null); + + /** CreateNodeRequest nodeId */ + nodeId?: (string|null); + + /** CreateNodeRequest node */ + node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** CreateNodeRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateNodeRequest. */ + class CreateNodeRequest implements ICreateNodeRequest { + + /** + * Constructs a new CreateNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest); + + /** CreateNodeRequest parent. */ + public parent: string; + + /** CreateNodeRequest nodeId. */ + public nodeId: string; + + /** CreateNodeRequest node. */ + public node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** CreateNodeRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ICreateNodeRequest): google.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @param message CreateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @param message CreateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICreateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateNodeRequest + * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateNodeRequest + * @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.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Verifies a CreateNodeRequest 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 CreateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.CreateNodeRequest; + + /** + * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. + * @param message CreateNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.CreateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteNodeRequest. */ + interface IDeleteNodeRequest { + + /** DeleteNodeRequest name */ + name?: (string|null); + + /** DeleteNodeRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteNodeRequest. */ + class DeleteNodeRequest implements IDeleteNodeRequest { + + /** + * Constructs a new DeleteNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest); + + /** DeleteNodeRequest name. */ + public name: string; + + /** DeleteNodeRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IDeleteNodeRequest): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @param message DeleteNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @param message DeleteNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IDeleteNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteNodeRequest + * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteNodeRequest + * @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.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Verifies a DeleteNodeRequest 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 DeleteNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.DeleteNodeRequest; + + /** + * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. + * @param message DeleteNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.DeleteNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StopNodeRequest. */ + interface IStopNodeRequest { + + /** StopNodeRequest name */ + name?: (string|null); + } + + /** Represents a StopNodeRequest. */ + class StopNodeRequest implements IStopNodeRequest { + + /** + * Constructs a new StopNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest); + + /** StopNodeRequest name. */ + public name: string; + + /** + * Creates a new StopNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StopNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IStopNodeRequest): google.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @param message StopNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @param message StopNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStopNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StopNodeRequest + * @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.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StopNodeRequest + * @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.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Verifies a StopNodeRequest 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 StopNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StopNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StopNodeRequest; + + /** + * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. + * @param message StopNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.StopNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StopNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StopNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StartNodeRequest. */ + interface IStartNodeRequest { + + /** StartNodeRequest name */ + name?: (string|null); + } + + /** Represents a StartNodeRequest. */ + class StartNodeRequest implements IStartNodeRequest { + + /** + * Constructs a new StartNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest); + + /** StartNodeRequest name. */ + public name: string; + + /** + * Creates a new StartNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StartNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IStartNodeRequest): google.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @param message StartNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @param message StartNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IStartNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StartNodeRequest + * @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.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StartNodeRequest + * @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.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Verifies a StartNodeRequest 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 StartNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StartNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.StartNodeRequest; + + /** + * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. + * @param message StartNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.StartNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StartNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StartNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateNodeRequest. */ + interface IUpdateNodeRequest { + + /** UpdateNodeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNodeRequest node */ + node?: (google.cloud.tpu.v2alpha1.INode|null); + } + + /** Represents an UpdateNodeRequest. */ + class UpdateNodeRequest implements IUpdateNodeRequest { + + /** + * Constructs a new UpdateNodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest); + + /** UpdateNodeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNodeRequest node. */ + public node?: (google.cloud.tpu.v2alpha1.INode|null); + + /** + * Creates a new UpdateNodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateNodeRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IUpdateNodeRequest): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @param message UpdateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @param message UpdateNodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IUpdateNodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateNodeRequest + * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Verifies an UpdateNodeRequest 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 an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateNodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + + /** + * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. + * @param message UpdateNodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.UpdateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateNodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateNodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListQueuedResourcesRequest. */ + interface IListQueuedResourcesRequest { + + /** ListQueuedResourcesRequest parent */ + parent?: (string|null); + + /** ListQueuedResourcesRequest pageSize */ + pageSize?: (number|null); + + /** ListQueuedResourcesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListQueuedResourcesRequest. */ + class ListQueuedResourcesRequest implements IListQueuedResourcesRequest { + + /** + * Constructs a new ListQueuedResourcesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest); + + /** ListQueuedResourcesRequest parent. */ + public parent: string; + + /** ListQueuedResourcesRequest pageSize. */ + public pageSize: number; + + /** ListQueuedResourcesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListQueuedResourcesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQueuedResourcesRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest): google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest; + + /** + * Encodes the specified ListQueuedResourcesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest.verify|verify} messages. + * @param message ListQueuedResourcesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQueuedResourcesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest.verify|verify} messages. + * @param message ListQueuedResourcesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQueuedResourcesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQueuedResourcesRequest + * @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.cloud.tpu.v2alpha1.ListQueuedResourcesRequest; + + /** + * Decodes a ListQueuedResourcesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQueuedResourcesRequest + * @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.cloud.tpu.v2alpha1.ListQueuedResourcesRequest; + + /** + * Verifies a ListQueuedResourcesRequest 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 ListQueuedResourcesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQueuedResourcesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest; + + /** + * Creates a plain object from a ListQueuedResourcesRequest message. Also converts values to other types if specified. + * @param message ListQueuedResourcesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQueuedResourcesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQueuedResourcesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListQueuedResourcesResponse. */ + interface IListQueuedResourcesResponse { + + /** ListQueuedResourcesResponse queuedResources */ + queuedResources?: (google.cloud.tpu.v2alpha1.IQueuedResource[]|null); + + /** ListQueuedResourcesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListQueuedResourcesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListQueuedResourcesResponse. */ + class ListQueuedResourcesResponse implements IListQueuedResourcesResponse { + + /** + * Constructs a new ListQueuedResourcesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse); + + /** ListQueuedResourcesResponse queuedResources. */ + public queuedResources: google.cloud.tpu.v2alpha1.IQueuedResource[]; + + /** ListQueuedResourcesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListQueuedResourcesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListQueuedResourcesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQueuedResourcesResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse): google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse; + + /** + * Encodes the specified ListQueuedResourcesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.verify|verify} messages. + * @param message ListQueuedResourcesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQueuedResourcesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.verify|verify} messages. + * @param message ListQueuedResourcesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQueuedResourcesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQueuedResourcesResponse + * @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.cloud.tpu.v2alpha1.ListQueuedResourcesResponse; + + /** + * Decodes a ListQueuedResourcesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQueuedResourcesResponse + * @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.cloud.tpu.v2alpha1.ListQueuedResourcesResponse; + + /** + * Verifies a ListQueuedResourcesResponse 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 ListQueuedResourcesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQueuedResourcesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse; + + /** + * Creates a plain object from a ListQueuedResourcesResponse message. Also converts values to other types if specified. + * @param message ListQueuedResourcesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQueuedResourcesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQueuedResourcesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetQueuedResourceRequest. */ + interface IGetQueuedResourceRequest { + + /** GetQueuedResourceRequest name */ + name?: (string|null); + } + + /** Represents a GetQueuedResourceRequest. */ + class GetQueuedResourceRequest implements IGetQueuedResourceRequest { + + /** + * Constructs a new GetQueuedResourceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest); + + /** GetQueuedResourceRequest name. */ + public name: string; + + /** + * Creates a new GetQueuedResourceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetQueuedResourceRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest): google.cloud.tpu.v2alpha1.GetQueuedResourceRequest; + + /** + * Encodes the specified GetQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetQueuedResourceRequest.verify|verify} messages. + * @param message GetQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetQueuedResourceRequest.verify|verify} messages. + * @param message GetQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetQueuedResourceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetQueuedResourceRequest + * @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.cloud.tpu.v2alpha1.GetQueuedResourceRequest; + + /** + * Decodes a GetQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetQueuedResourceRequest + * @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.cloud.tpu.v2alpha1.GetQueuedResourceRequest; + + /** + * Verifies a GetQueuedResourceRequest 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 GetQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetQueuedResourceRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.GetQueuedResourceRequest; + + /** + * Creates a plain object from a GetQueuedResourceRequest message. Also converts values to other types if specified. + * @param message GetQueuedResourceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.GetQueuedResourceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetQueuedResourceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetQueuedResourceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateQueuedResourceRequest. */ + interface ICreateQueuedResourceRequest { + + /** CreateQueuedResourceRequest parent */ + parent?: (string|null); + + /** CreateQueuedResourceRequest queuedResourceId */ + queuedResourceId?: (string|null); + + /** CreateQueuedResourceRequest queuedResource */ + queuedResource?: (google.cloud.tpu.v2alpha1.IQueuedResource|null); + + /** CreateQueuedResourceRequest requestId */ + requestId?: (string|null); + } + + /** Represents a CreateQueuedResourceRequest. */ + class CreateQueuedResourceRequest implements ICreateQueuedResourceRequest { + + /** + * Constructs a new CreateQueuedResourceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest); + + /** CreateQueuedResourceRequest parent. */ + public parent: string; + + /** CreateQueuedResourceRequest queuedResourceId. */ + public queuedResourceId: string; + + /** CreateQueuedResourceRequest queuedResource. */ + public queuedResource?: (google.cloud.tpu.v2alpha1.IQueuedResource|null); + + /** CreateQueuedResourceRequest requestId. */ + public requestId: string; + + /** + * Creates a new CreateQueuedResourceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateQueuedResourceRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest): google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest; + + /** + * Encodes the specified CreateQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest.verify|verify} messages. + * @param message CreateQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest.verify|verify} messages. + * @param message CreateQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateQueuedResourceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateQueuedResourceRequest + * @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.cloud.tpu.v2alpha1.CreateQueuedResourceRequest; + + /** + * Decodes a CreateQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateQueuedResourceRequest + * @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.cloud.tpu.v2alpha1.CreateQueuedResourceRequest; + + /** + * Verifies a CreateQueuedResourceRequest 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 CreateQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateQueuedResourceRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest; + + /** + * Creates a plain object from a CreateQueuedResourceRequest message. Also converts values to other types if specified. + * @param message CreateQueuedResourceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateQueuedResourceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateQueuedResourceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteQueuedResourceRequest. */ + interface IDeleteQueuedResourceRequest { + + /** DeleteQueuedResourceRequest name */ + name?: (string|null); + + /** DeleteQueuedResourceRequest requestId */ + requestId?: (string|null); + } + + /** Represents a DeleteQueuedResourceRequest. */ + class DeleteQueuedResourceRequest implements IDeleteQueuedResourceRequest { + + /** + * Constructs a new DeleteQueuedResourceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest); + + /** DeleteQueuedResourceRequest name. */ + public name: string; + + /** DeleteQueuedResourceRequest requestId. */ + public requestId: string; + + /** + * Creates a new DeleteQueuedResourceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteQueuedResourceRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest): google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest; + + /** + * Encodes the specified DeleteQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest.verify|verify} messages. + * @param message DeleteQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest.verify|verify} messages. + * @param message DeleteQueuedResourceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteQueuedResourceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteQueuedResourceRequest * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest; /** - * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteQueuedResourceRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateNodeRequest + * @returns DeleteQueuedResourceRequest * @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.cloud.tpu.v2alpha1.UpdateNodeRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest; /** - * Verifies an UpdateNodeRequest message. + * Verifies a DeleteQueuedResourceRequest 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 an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateNodeRequest + * @returns DeleteQueuedResourceRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.UpdateNodeRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest; /** - * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. - * @param message UpdateNodeRequest + * Creates a plain object from a DeleteQueuedResourceRequest message. Also converts values to other types if specified. + * @param message DeleteQueuedResourceRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.UpdateNodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateNodeRequest to JSON. + * Converts this DeleteQueuedResourceRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for UpdateNodeRequest + * Gets the default type url for DeleteQueuedResourceRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -5711,139 +11975,6 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata target */ - target?: (string|null); - - /** OperationMetadata verb */ - verb?: (string|null); - - /** OperationMetadata statusDetail */ - statusDetail?: (string|null); - - /** OperationMetadata cancelRequested */ - cancelRequested?: (boolean|null); - - /** OperationMetadata apiVersion */ - apiVersion?: (string|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata target. */ - public target: string; - - /** OperationMetadata verb. */ - public verb: string; - - /** OperationMetadata statusDetail. */ - public statusDetail: string; - - /** OperationMetadata cancelRequested. */ - public cancelRequested: boolean; - - /** OperationMetadata apiVersion. */ - public apiVersion: string; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata): google.cloud.tpu.v2alpha1.OperationMetadata; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationMetadata - * @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.cloud.tpu.v2alpha1.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationMetadata - * @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.cloud.tpu.v2alpha1.OperationMetadata; - - /** - * Verifies an OperationMetadata 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.OperationMetadata; - - /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @param message OperationMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.tpu.v2alpha1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - /** Properties of a RuntimeVersion. */ interface IRuntimeVersion { @@ -6141,133 +12272,266 @@ export namespace google { * @param object Plain object * @returns ListRuntimeVersionsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest; + + /** + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimeVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimeVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRuntimeVersionsResponse. */ + interface IListRuntimeVersionsResponse { + + /** ListRuntimeVersionsResponse runtimeVersions */ + runtimeVersions?: (google.cloud.tpu.v2alpha1.IRuntimeVersion[]|null); + + /** ListRuntimeVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListRuntimeVersionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListRuntimeVersionsResponse. */ + class ListRuntimeVersionsResponse implements IListRuntimeVersionsResponse { + + /** + * Constructs a new ListRuntimeVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse); + + /** ListRuntimeVersionsResponse runtimeVersions. */ + public runtimeVersions: google.cloud.tpu.v2alpha1.IRuntimeVersion[]; + + /** ListRuntimeVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListRuntimeVersionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimeVersionsResponse instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @param message ListRuntimeVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimeVersionsResponse + * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + + /** + * Verifies a ListRuntimeVersionsResponse 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 ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimeVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; /** - * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. - * @param message ListRuntimeVersionsRequest + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * @param message ListRuntimeVersionsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListRuntimeVersionsRequest to JSON. + * Converts this ListRuntimeVersionsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListRuntimeVersionsRequest + * Gets the default type url for ListRuntimeVersionsResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ListRuntimeVersionsResponse. */ - interface IListRuntimeVersionsResponse { + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { - /** ListRuntimeVersionsResponse runtimeVersions */ - runtimeVersions?: (google.cloud.tpu.v2alpha1.IRuntimeVersion[]|null); + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** ListRuntimeVersionsResponse nextPageToken */ - nextPageToken?: (string|null); + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); - /** ListRuntimeVersionsResponse unreachable */ - unreachable?: (string[]|null); + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); } - /** Represents a ListRuntimeVersionsResponse. */ - class ListRuntimeVersionsResponse implements IListRuntimeVersionsResponse { + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { /** - * Constructs a new ListRuntimeVersionsResponse. + * Constructs a new OperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse); + constructor(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata); - /** ListRuntimeVersionsResponse runtimeVersions. */ - public runtimeVersions: google.cloud.tpu.v2alpha1.IRuntimeVersion[]; + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** ListRuntimeVersionsResponse nextPageToken. */ - public nextPageToken: string; + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); - /** ListRuntimeVersionsResponse unreachable. */ - public unreachable: string[]; + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; /** - * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ListRuntimeVersionsResponse instance + * @returns OperationMetadata instance */ - public static create(properties?: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + public static create(properties?: google.cloud.tpu.v2alpha1.IOperationMetadata): google.cloud.tpu.v2alpha1.OperationMetadata; /** - * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. - * @param message ListRuntimeVersionsResponse message or plain object to encode + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. - * @param message ListRuntimeVersionsResponse message or plain object to encode + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListRuntimeVersionsResponse + * @returns OperationMetadata * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.tpu.v2alpha1.OperationMetadata; /** - * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListRuntimeVersionsResponse + * @returns OperationMetadata * @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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.tpu.v2alpha1.OperationMetadata; /** - * Verifies a ListRuntimeVersionsResponse message. + * Verifies an OperationMetadata 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 ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListRuntimeVersionsResponse + * @returns OperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.OperationMetadata; /** - * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. - * @param message ListRuntimeVersionsResponse + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.tpu.v2alpha1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListRuntimeVersionsResponse to JSON. + * Converts this OperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ListRuntimeVersionsResponse + * Gets the default type url for OperationMetadata * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -6609,6 +12873,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a SimulateMaintenanceEventRequest. */ + interface ISimulateMaintenanceEventRequest { + + /** SimulateMaintenanceEventRequest name */ + name?: (string|null); + + /** SimulateMaintenanceEventRequest workerIds */ + workerIds?: (string[]|null); + } + + /** Represents a SimulateMaintenanceEventRequest. */ + class SimulateMaintenanceEventRequest implements ISimulateMaintenanceEventRequest { + + /** + * Constructs a new SimulateMaintenanceEventRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest); + + /** SimulateMaintenanceEventRequest name. */ + public name: string; + + /** SimulateMaintenanceEventRequest workerIds. */ + public workerIds: string[]; + + /** + * Creates a new SimulateMaintenanceEventRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SimulateMaintenanceEventRequest instance + */ + public static create(properties?: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest): google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest; + + /** + * Encodes the specified SimulateMaintenanceEventRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest.verify|verify} messages. + * @param message SimulateMaintenanceEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SimulateMaintenanceEventRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest.verify|verify} messages. + * @param message SimulateMaintenanceEventRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimulateMaintenanceEventRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SimulateMaintenanceEventRequest + * @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.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest; + + /** + * Decodes a SimulateMaintenanceEventRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SimulateMaintenanceEventRequest + * @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.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest; + + /** + * Verifies a SimulateMaintenanceEventRequest 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 SimulateMaintenanceEventRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SimulateMaintenanceEventRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest; + + /** + * Creates a plain object from a SimulateMaintenanceEventRequest message. Also converts values to other types if specified. + * @param message SimulateMaintenanceEventRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SimulateMaintenanceEventRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SimulateMaintenanceEventRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ShieldedInstanceConfig. */ interface IShieldedInstanceConfig { @@ -12268,4 +18635,111 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } } + + /** Namespace type. */ + namespace type { + + /** Properties of an Interval. */ + interface IInterval { + + /** Interval startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Interval endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IInterval); + + /** Interval startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Interval endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.type.IInterval): google.type.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @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.type.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @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.type.Interval; + + /** + * Verifies an Interval 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 an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.type.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } diff --git a/packages/google-cloud-tpu/protos/protos.js b/packages/google-cloud-tpu/protos/protos.js index fcfa3ce6e6e..f4cd0f8675d 100644 --- a/packages/google-cloud-tpu/protos/protos.js +++ b/packages/google-cloud-tpu/protos/protos.js @@ -6419,20 +6419,20 @@ return v1; })(); - tpu.v2alpha1 = (function() { + tpu.v2 = (function() { /** - * Namespace v2alpha1. + * Namespace v2. * @memberof google.cloud.tpu * @namespace */ - var v2alpha1 = {}; + var v2 = {}; - v2alpha1.Tpu = (function() { + v2.Tpu = (function() { /** * Constructs a new Tpu service. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a Tpu * @extends $protobuf.rpc.Service * @constructor @@ -6449,7 +6449,7 @@ /** * Creates new Tpu service using the specified rpc implementation. * @function create - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited @@ -6461,74 +6461,74 @@ }; /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listNodes}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listNodes}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef ListNodesCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} [response] ListNodesResponse + * @param {google.cloud.tpu.v2.ListNodesResponse} [response] ListNodesResponse */ /** * Calls ListNodes. * @function listNodes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback} callback Node-style callback called with the error, if any, and ListNodesResponse + * @param {google.cloud.tpu.v2.IListNodesRequest} request ListNodesRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.ListNodesCallback} callback Node-style callback called with the error, if any, and ListNodesResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.listNodes = function listNodes(request, callback) { - return this.rpcCall(listNodes, $root.google.cloud.tpu.v2alpha1.ListNodesRequest, $root.google.cloud.tpu.v2alpha1.ListNodesResponse, request, callback); + return this.rpcCall(listNodes, $root.google.cloud.tpu.v2.ListNodesRequest, $root.google.cloud.tpu.v2.ListNodesResponse, request, callback); }, "name", { value: "ListNodes" }); /** * Calls ListNodes. * @function listNodes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IListNodesRequest} request ListNodesRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef GetNodeCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.Node} [response] Node + * @param {google.cloud.tpu.v2.Node} [response] Node */ /** * Calls GetNode. * @function getNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback} callback Node-style callback called with the error, if any, and Node + * @param {google.cloud.tpu.v2.IGetNodeRequest} request GetNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.GetNodeCallback} callback Node-style callback called with the error, if any, and Node * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.getNode = function getNode(request, callback) { - return this.rpcCall(getNode, $root.google.cloud.tpu.v2alpha1.GetNodeRequest, $root.google.cloud.tpu.v2alpha1.Node, request, callback); + return this.rpcCall(getNode, $root.google.cloud.tpu.v2.GetNodeRequest, $root.google.cloud.tpu.v2.Node, request, callback); }, "name", { value: "GetNode" }); /** * Calls GetNode. * @function getNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IGetNodeRequest} request GetNodeRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|createNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef CreateNodeCallback * @type {function} * @param {Error|null} error Error, if any @@ -6538,30 +6538,30 @@ /** * Calls CreateNode. * @function createNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.tpu.v2.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.CreateNodeCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.createNode = function createNode(request, callback) { - return this.rpcCall(createNode, $root.google.cloud.tpu.v2alpha1.CreateNodeRequest, $root.google.longrunning.Operation, request, callback); + return this.rpcCall(createNode, $root.google.cloud.tpu.v2.CreateNodeRequest, $root.google.longrunning.Operation, request, callback); }, "name", { value: "CreateNode" }); /** * Calls CreateNode. * @function createNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @param {google.cloud.tpu.v2.ICreateNodeRequest} request CreateNodeRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|deleteNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef DeleteNodeCallback * @type {function} * @param {Error|null} error Error, if any @@ -6571,30 +6571,30 @@ /** * Calls DeleteNode. * @function deleteNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.tpu.v2.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.DeleteNodeCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.deleteNode = function deleteNode(request, callback) { - return this.rpcCall(deleteNode, $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest, $root.google.longrunning.Operation, request, callback); + return this.rpcCall(deleteNode, $root.google.cloud.tpu.v2.DeleteNodeRequest, $root.google.longrunning.Operation, request, callback); }, "name", { value: "DeleteNode" }); /** * Calls DeleteNode. * @function deleteNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @param {google.cloud.tpu.v2.IDeleteNodeRequest} request DeleteNodeRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|stopNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|stopNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef StopNodeCallback * @type {function} * @param {Error|null} error Error, if any @@ -6604,30 +6604,30 @@ /** * Calls StopNode. * @function stopNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.tpu.v2.IStopNodeRequest} request StopNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.StopNodeCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.stopNode = function stopNode(request, callback) { - return this.rpcCall(stopNode, $root.google.cloud.tpu.v2alpha1.StopNodeRequest, $root.google.longrunning.Operation, request, callback); + return this.rpcCall(stopNode, $root.google.cloud.tpu.v2.StopNodeRequest, $root.google.longrunning.Operation, request, callback); }, "name", { value: "StopNode" }); /** * Calls StopNode. * @function stopNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object + * @param {google.cloud.tpu.v2.IStopNodeRequest} request StopNodeRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|startNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|startNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef StartNodeCallback * @type {function} * @param {Error|null} error Error, if any @@ -6637,30 +6637,30 @@ /** * Calls StartNode. * @function startNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.tpu.v2.IStartNodeRequest} request StartNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.StartNodeCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.startNode = function startNode(request, callback) { - return this.rpcCall(startNode, $root.google.cloud.tpu.v2alpha1.StartNodeRequest, $root.google.longrunning.Operation, request, callback); + return this.rpcCall(startNode, $root.google.cloud.tpu.v2.StartNodeRequest, $root.google.longrunning.Operation, request, callback); }, "name", { value: "StartNode" }); /** * Calls StartNode. * @function startNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object + * @param {google.cloud.tpu.v2.IStartNodeRequest} request StartNodeRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|updateNode}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|updateNode}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef UpdateNodeCallback * @type {function} * @param {Error|null} error Error, if any @@ -6670,245 +6670,245 @@ /** * Calls UpdateNode. * @function updateNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @param {google.cloud.tpu.v2.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.UpdateNodeCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.updateNode = function updateNode(request, callback) { - return this.rpcCall(updateNode, $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest, $root.google.longrunning.Operation, request, callback); + return this.rpcCall(updateNode, $root.google.cloud.tpu.v2.UpdateNodeRequest, $root.google.longrunning.Operation, request, callback); }, "name", { value: "UpdateNode" }); /** * Calls UpdateNode. * @function updateNode - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @param {google.cloud.tpu.v2.IUpdateNodeRequest} request UpdateNodeRequest message or plain object * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|generateServiceIdentity}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef GenerateServiceIdentityCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} [response] GenerateServiceIdentityResponse + * @param {google.cloud.tpu.v2.GenerateServiceIdentityResponse} [response] GenerateServiceIdentityResponse */ /** * Calls GenerateServiceIdentity. * @function generateServiceIdentity - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback} callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.GenerateServiceIdentityCallback} callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.generateServiceIdentity = function generateServiceIdentity(request, callback) { - return this.rpcCall(generateServiceIdentity, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse, request, callback); + return this.rpcCall(generateServiceIdentity, $root.google.cloud.tpu.v2.GenerateServiceIdentityRequest, $root.google.cloud.tpu.v2.GenerateServiceIdentityResponse, request, callback); }, "name", { value: "GenerateServiceIdentity" }); /** * Calls GenerateServiceIdentity. * @function generateServiceIdentity - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listAcceleratorTypes}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listAcceleratorTypes}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef ListAcceleratorTypesCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} [response] ListAcceleratorTypesResponse + * @param {google.cloud.tpu.v2.ListAcceleratorTypesResponse} [response] ListAcceleratorTypesResponse */ /** * Calls ListAcceleratorTypes. * @function listAcceleratorTypes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback} callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.ListAcceleratorTypesCallback} callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.listAcceleratorTypes = function listAcceleratorTypes(request, callback) { - return this.rpcCall(listAcceleratorTypes, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse, request, callback); + return this.rpcCall(listAcceleratorTypes, $root.google.cloud.tpu.v2.ListAcceleratorTypesRequest, $root.google.cloud.tpu.v2.ListAcceleratorTypesResponse, request, callback); }, "name", { value: "ListAcceleratorTypes" }); /** * Calls ListAcceleratorTypes. * @function listAcceleratorTypes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getAcceleratorType}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getAcceleratorType}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef GetAcceleratorTypeCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.AcceleratorType} [response] AcceleratorType + * @param {google.cloud.tpu.v2.AcceleratorType} [response] AcceleratorType */ /** * Calls GetAcceleratorType. * @function getAcceleratorType - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback} callback Node-style callback called with the error, if any, and AcceleratorType + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.GetAcceleratorTypeCallback} callback Node-style callback called with the error, if any, and AcceleratorType * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.getAcceleratorType = function getAcceleratorType(request, callback) { - return this.rpcCall(getAcceleratorType, $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest, $root.google.cloud.tpu.v2alpha1.AcceleratorType, request, callback); + return this.rpcCall(getAcceleratorType, $root.google.cloud.tpu.v2.GetAcceleratorTypeRequest, $root.google.cloud.tpu.v2.AcceleratorType, request, callback); }, "name", { value: "GetAcceleratorType" }); /** * Calls GetAcceleratorType. * @function getAcceleratorType - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listRuntimeVersions}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|listRuntimeVersions}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef ListRuntimeVersionsCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} [response] ListRuntimeVersionsResponse + * @param {google.cloud.tpu.v2.ListRuntimeVersionsResponse} [response] ListRuntimeVersionsResponse */ /** * Calls ListRuntimeVersions. * @function listRuntimeVersions - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback} callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.ListRuntimeVersionsCallback} callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.listRuntimeVersions = function listRuntimeVersions(request, callback) { - return this.rpcCall(listRuntimeVersions, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, request, callback); + return this.rpcCall(listRuntimeVersions, $root.google.cloud.tpu.v2.ListRuntimeVersionsRequest, $root.google.cloud.tpu.v2.ListRuntimeVersionsResponse, request, callback); }, "name", { value: "ListRuntimeVersions" }); /** * Calls ListRuntimeVersions. * @function listRuntimeVersions - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getRuntimeVersion}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getRuntimeVersion}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef GetRuntimeVersionCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} [response] RuntimeVersion + * @param {google.cloud.tpu.v2.RuntimeVersion} [response] RuntimeVersion */ /** * Calls GetRuntimeVersion. * @function getRuntimeVersion - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback} callback Node-style callback called with the error, if any, and RuntimeVersion + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.GetRuntimeVersionCallback} callback Node-style callback called with the error, if any, and RuntimeVersion * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.getRuntimeVersion = function getRuntimeVersion(request, callback) { - return this.rpcCall(getRuntimeVersion, $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest, $root.google.cloud.tpu.v2alpha1.RuntimeVersion, request, callback); + return this.rpcCall(getRuntimeVersion, $root.google.cloud.tpu.v2.GetRuntimeVersionRequest, $root.google.cloud.tpu.v2.RuntimeVersion, request, callback); }, "name", { value: "GetRuntimeVersion" }); /** * Calls GetRuntimeVersion. * @function getRuntimeVersion - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getGuestAttributes}. - * @memberof google.cloud.tpu.v2alpha1.Tpu + * Callback as used by {@link google.cloud.tpu.v2.Tpu|getGuestAttributes}. + * @memberof google.cloud.tpu.v2.Tpu * @typedef GetGuestAttributesCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} [response] GetGuestAttributesResponse + * @param {google.cloud.tpu.v2.GetGuestAttributesResponse} [response] GetGuestAttributesResponse */ /** * Calls GetGuestAttributes. * @function getGuestAttributes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object - * @param {google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback} callback Node-style callback called with the error, if any, and GetGuestAttributesResponse + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @param {google.cloud.tpu.v2.Tpu.GetGuestAttributesCallback} callback Node-style callback called with the error, if any, and GetGuestAttributesResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Tpu.prototype.getGuestAttributes = function getGuestAttributes(request, callback) { - return this.rpcCall(getGuestAttributes, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse, request, callback); + return this.rpcCall(getGuestAttributes, $root.google.cloud.tpu.v2.GetGuestAttributesRequest, $root.google.cloud.tpu.v2.GetGuestAttributesResponse, request, callback); }, "name", { value: "GetGuestAttributes" }); /** * Calls GetGuestAttributes. * @function getGuestAttributes - * @memberof google.cloud.tpu.v2alpha1.Tpu + * @memberof google.cloud.tpu.v2.Tpu * @instance - * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object - * @returns {Promise} Promise + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ return Tpu; })(); - v2alpha1.GuestAttributes = (function() { + v2.GuestAttributes = (function() { /** * Properties of a GuestAttributes. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGuestAttributes * @property {string|null} [queryPath] GuestAttributes queryPath - * @property {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null} [queryValue] GuestAttributes queryValue + * @property {google.cloud.tpu.v2.IGuestAttributesValue|null} [queryValue] GuestAttributes queryValue */ /** * Constructs a new GuestAttributes. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GuestAttributes. * @implements IGuestAttributes * @constructor - * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGuestAttributes=} [properties] Properties to set */ function GuestAttributes(properties) { if (properties) @@ -6920,15 +6920,15 @@ /** * GuestAttributes queryPath. * @member {string} queryPath - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @instance */ GuestAttributes.prototype.queryPath = ""; /** * GuestAttributes queryValue. - * @member {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null|undefined} queryValue - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @member {google.cloud.tpu.v2.IGuestAttributesValue|null|undefined} queryValue + * @memberof google.cloud.tpu.v2.GuestAttributes * @instance */ GuestAttributes.prototype.queryValue = null; @@ -6936,21 +6936,21 @@ /** * Creates a new GuestAttributes instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes instance + * @param {google.cloud.tpu.v2.IGuestAttributes=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GuestAttributes} GuestAttributes instance */ GuestAttributes.create = function create(properties) { return new GuestAttributes(properties); }; /** - * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributes.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributes} message GuestAttributes message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -6960,16 +6960,16 @@ if (message.queryPath != null && Object.hasOwnProperty.call(message, "queryPath")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.queryPath); if (message.queryValue != null && Object.hasOwnProperty.call(message, "queryValue")) - $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.encode(message.queryValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.cloud.tpu.v2.GuestAttributesValue.encode(message.queryValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributes.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributes} message GuestAttributes message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -6980,18 +6980,18 @@ /** * Decodes a GuestAttributes message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @returns {google.cloud.tpu.v2.GuestAttributes} GuestAttributes * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GuestAttributes.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.cloud.tpu.v2alpha1.GuestAttributes(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GuestAttributes(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7000,7 +7000,7 @@ break; } case 2: { - message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.decode(reader, reader.uint32()); + message.queryValue = $root.google.cloud.tpu.v2.GuestAttributesValue.decode(reader, reader.uint32()); break; } default: @@ -7014,10 +7014,10 @@ /** * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @returns {google.cloud.tpu.v2.GuestAttributes} GuestAttributes * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -7030,7 +7030,7 @@ /** * Verifies a GuestAttributes message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -7042,7 +7042,7 @@ if (!$util.isString(message.queryPath)) return "queryPath: string expected"; if (message.queryValue != null && message.hasOwnProperty("queryValue")) { - var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.verify(message.queryValue); + var error = $root.google.cloud.tpu.v2.GuestAttributesValue.verify(message.queryValue); if (error) return "queryValue." + error; } @@ -7052,21 +7052,21 @@ /** * Creates a GuestAttributes message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @returns {google.cloud.tpu.v2.GuestAttributes} GuestAttributes */ GuestAttributes.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributes) + if (object instanceof $root.google.cloud.tpu.v2.GuestAttributes) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributes(); + var message = new $root.google.cloud.tpu.v2.GuestAttributes(); if (object.queryPath != null) message.queryPath = String(object.queryPath); if (object.queryValue != null) { if (typeof object.queryValue !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributes.queryValue: object expected"); - message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.fromObject(object.queryValue); + throw TypeError(".google.cloud.tpu.v2.GuestAttributes.queryValue: object expected"); + message.queryValue = $root.google.cloud.tpu.v2.GuestAttributesValue.fromObject(object.queryValue); } return message; }; @@ -7074,9 +7074,9 @@ /** * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static - * @param {google.cloud.tpu.v2alpha1.GuestAttributes} message GuestAttributes + * @param {google.cloud.tpu.v2.GuestAttributes} message GuestAttributes * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -7091,14 +7091,14 @@ if (message.queryPath != null && message.hasOwnProperty("queryPath")) object.queryPath = message.queryPath; if (message.queryValue != null && message.hasOwnProperty("queryValue")) - object.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.toObject(message.queryValue, options); + object.queryValue = $root.google.cloud.tpu.v2.GuestAttributesValue.toObject(message.queryValue, options); return object; }; /** * Converts this GuestAttributes to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @instance * @returns {Object.} JSON object */ @@ -7109,7 +7109,7 @@ /** * Gets the default type url for GuestAttributes * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @memberof google.cloud.tpu.v2.GuestAttributes * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -7118,28 +7118,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributes"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GuestAttributes"; }; return GuestAttributes; })(); - v2alpha1.GuestAttributesValue = (function() { + v2.GuestAttributesValue = (function() { /** * Properties of a GuestAttributesValue. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGuestAttributesValue - * @property {Array.|null} [items] GuestAttributesValue items + * @property {Array.|null} [items] GuestAttributesValue items */ /** * Constructs a new GuestAttributesValue. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GuestAttributesValue. * @implements IGuestAttributesValue * @constructor - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGuestAttributesValue=} [properties] Properties to set */ function GuestAttributesValue(properties) { this.items = []; @@ -7151,8 +7151,8 @@ /** * GuestAttributesValue items. - * @member {Array.} items - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @member {Array.} items + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @instance */ GuestAttributesValue.prototype.items = $util.emptyArray; @@ -7160,21 +7160,21 @@ /** * Creates a new GuestAttributesValue instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue instance + * @param {google.cloud.tpu.v2.IGuestAttributesValue=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GuestAttributesValue} GuestAttributesValue instance */ GuestAttributesValue.create = function create(properties) { return new GuestAttributesValue(properties); }; /** - * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesValue.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7183,16 +7183,16 @@ writer = $Writer.create(); if (message.items != null && message.items.length) for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.tpu.v2.GuestAttributesEntry.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesValue.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7203,25 +7203,25 @@ /** * Decodes a GuestAttributesValue message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @returns {google.cloud.tpu.v2.GuestAttributesValue} GuestAttributesValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GuestAttributesValue.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.cloud.tpu.v2alpha1.GuestAttributesValue(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GuestAttributesValue(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.items && message.items.length)) message.items = []; - message.items.push($root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.decode(reader, reader.uint32())); + message.items.push($root.google.cloud.tpu.v2.GuestAttributesEntry.decode(reader, reader.uint32())); break; } default: @@ -7235,10 +7235,10 @@ /** * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @returns {google.cloud.tpu.v2.GuestAttributesValue} GuestAttributesValue * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -7251,7 +7251,7 @@ /** * Verifies a GuestAttributesValue message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -7263,7 +7263,7 @@ if (!Array.isArray(message.items)) return "items: array expected"; for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify(message.items[i]); + var error = $root.google.cloud.tpu.v2.GuestAttributesEntry.verify(message.items[i]); if (error) return "items." + error; } @@ -7274,23 +7274,23 @@ /** * Creates a GuestAttributesValue message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @returns {google.cloud.tpu.v2.GuestAttributesValue} GuestAttributesValue */ GuestAttributesValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesValue) + if (object instanceof $root.google.cloud.tpu.v2.GuestAttributesValue) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesValue(); + var message = new $root.google.cloud.tpu.v2.GuestAttributesValue(); if (object.items) { if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: array expected"); + throw TypeError(".google.cloud.tpu.v2.GuestAttributesValue.items: array expected"); message.items = []; for (var i = 0; i < object.items.length; ++i) { if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: object expected"); - message.items[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.fromObject(object.items[i]); + throw TypeError(".google.cloud.tpu.v2.GuestAttributesValue.items: object expected"); + message.items[i] = $root.google.cloud.tpu.v2.GuestAttributesEntry.fromObject(object.items[i]); } } return message; @@ -7299,9 +7299,9 @@ /** * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static - * @param {google.cloud.tpu.v2alpha1.GuestAttributesValue} message GuestAttributesValue + * @param {google.cloud.tpu.v2.GuestAttributesValue} message GuestAttributesValue * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -7314,7 +7314,7 @@ if (message.items && message.items.length) { object.items = []; for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.toObject(message.items[j], options); + object.items[j] = $root.google.cloud.tpu.v2.GuestAttributesEntry.toObject(message.items[j], options); } return object; }; @@ -7322,7 +7322,7 @@ /** * Converts this GuestAttributesValue to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @instance * @returns {Object.} JSON object */ @@ -7333,7 +7333,7 @@ /** * Gets the default type url for GuestAttributesValue * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @memberof google.cloud.tpu.v2.GuestAttributesValue * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -7342,17 +7342,17 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributesValue"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GuestAttributesValue"; }; return GuestAttributesValue; })(); - v2alpha1.GuestAttributesEntry = (function() { + v2.GuestAttributesEntry = (function() { /** * Properties of a GuestAttributesEntry. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGuestAttributesEntry * @property {string|null} [namespace] GuestAttributesEntry namespace * @property {string|null} [key] GuestAttributesEntry key @@ -7361,11 +7361,11 @@ /** * Constructs a new GuestAttributesEntry. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GuestAttributesEntry. * @implements IGuestAttributesEntry * @constructor - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGuestAttributesEntry=} [properties] Properties to set */ function GuestAttributesEntry(properties) { if (properties) @@ -7377,7 +7377,7 @@ /** * GuestAttributesEntry namespace. * @member {string} namespace - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @instance */ GuestAttributesEntry.prototype.namespace = ""; @@ -7385,7 +7385,7 @@ /** * GuestAttributesEntry key. * @member {string} key - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @instance */ GuestAttributesEntry.prototype.key = ""; @@ -7393,7 +7393,7 @@ /** * GuestAttributesEntry value. * @member {string} value - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @instance */ GuestAttributesEntry.prototype.value = ""; @@ -7401,21 +7401,21 @@ /** * Creates a new GuestAttributesEntry instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry instance + * @param {google.cloud.tpu.v2.IGuestAttributesEntry=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GuestAttributesEntry} GuestAttributesEntry instance */ GuestAttributesEntry.create = function create(properties) { return new GuestAttributesEntry(properties); }; /** - * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesEntry.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7432,11 +7432,11 @@ }; /** - * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GuestAttributesEntry.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static - * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {google.cloud.tpu.v2.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7447,18 +7447,18 @@ /** * Decodes a GuestAttributesEntry message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @returns {google.cloud.tpu.v2.GuestAttributesEntry} GuestAttributesEntry * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GuestAttributesEntry.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.cloud.tpu.v2alpha1.GuestAttributesEntry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GuestAttributesEntry(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7485,10 +7485,10 @@ /** * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @returns {google.cloud.tpu.v2.GuestAttributesEntry} GuestAttributesEntry * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -7501,7 +7501,7 @@ /** * Verifies a GuestAttributesEntry message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -7524,15 +7524,15 @@ /** * Creates a GuestAttributesEntry message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @returns {google.cloud.tpu.v2.GuestAttributesEntry} GuestAttributesEntry */ GuestAttributesEntry.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry) + if (object instanceof $root.google.cloud.tpu.v2.GuestAttributesEntry) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry(); + var message = new $root.google.cloud.tpu.v2.GuestAttributesEntry(); if (object.namespace != null) message.namespace = String(object.namespace); if (object.key != null) @@ -7545,9 +7545,9 @@ /** * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static - * @param {google.cloud.tpu.v2alpha1.GuestAttributesEntry} message GuestAttributesEntry + * @param {google.cloud.tpu.v2.GuestAttributesEntry} message GuestAttributesEntry * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -7572,7 +7572,7 @@ /** * Converts this GuestAttributesEntry to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @instance * @returns {Object.} JSON object */ @@ -7583,7 +7583,7 @@ /** * Gets the default type url for GuestAttributesEntry * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @memberof google.cloud.tpu.v2.GuestAttributesEntry * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -7592,29 +7592,29 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributesEntry"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GuestAttributesEntry"; }; return GuestAttributesEntry; })(); - v2alpha1.AttachedDisk = (function() { + v2.AttachedDisk = (function() { /** * Properties of an AttachedDisk. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IAttachedDisk * @property {string|null} [sourceDisk] AttachedDisk sourceDisk - * @property {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null} [mode] AttachedDisk mode + * @property {google.cloud.tpu.v2.AttachedDisk.DiskMode|null} [mode] AttachedDisk mode */ /** * Constructs a new AttachedDisk. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents an AttachedDisk. * @implements IAttachedDisk * @constructor - * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IAttachedDisk=} [properties] Properties to set */ function AttachedDisk(properties) { if (properties) @@ -7626,15 +7626,15 @@ /** * AttachedDisk sourceDisk. * @member {string} sourceDisk - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @instance */ AttachedDisk.prototype.sourceDisk = ""; /** * AttachedDisk mode. - * @member {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode} mode - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @member {google.cloud.tpu.v2.AttachedDisk.DiskMode} mode + * @memberof google.cloud.tpu.v2.AttachedDisk * @instance */ AttachedDisk.prototype.mode = 0; @@ -7642,21 +7642,21 @@ /** * Creates a new AttachedDisk instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static - * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk instance + * @param {google.cloud.tpu.v2.IAttachedDisk=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.AttachedDisk} AttachedDisk instance */ AttachedDisk.create = function create(properties) { return new AttachedDisk(properties); }; /** - * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2.AttachedDisk.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static - * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {google.cloud.tpu.v2.IAttachedDisk} message AttachedDisk message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7671,11 +7671,11 @@ }; /** - * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AttachedDisk.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static - * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {google.cloud.tpu.v2.IAttachedDisk} message AttachedDisk message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7686,18 +7686,18 @@ /** * Decodes an AttachedDisk message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @returns {google.cloud.tpu.v2.AttachedDisk} AttachedDisk * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ AttachedDisk.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.cloud.tpu.v2alpha1.AttachedDisk(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.AttachedDisk(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7720,10 +7720,10 @@ /** * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @returns {google.cloud.tpu.v2.AttachedDisk} AttachedDisk * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -7736,7 +7736,7 @@ /** * Verifies an AttachedDisk message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -7762,15 +7762,15 @@ /** * Creates an AttachedDisk message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @returns {google.cloud.tpu.v2.AttachedDisk} AttachedDisk */ AttachedDisk.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.AttachedDisk) + if (object instanceof $root.google.cloud.tpu.v2.AttachedDisk) return object; - var message = new $root.google.cloud.tpu.v2alpha1.AttachedDisk(); + var message = new $root.google.cloud.tpu.v2.AttachedDisk(); if (object.sourceDisk != null) message.sourceDisk = String(object.sourceDisk); switch (object.mode) { @@ -7799,9 +7799,9 @@ /** * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static - * @param {google.cloud.tpu.v2alpha1.AttachedDisk} message AttachedDisk + * @param {google.cloud.tpu.v2.AttachedDisk} message AttachedDisk * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -7816,14 +7816,14 @@ if (message.sourceDisk != null && message.hasOwnProperty("sourceDisk")) object.sourceDisk = message.sourceDisk; if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode[message.mode] === undefined ? message.mode : $root.google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode[message.mode] : message.mode; + object.mode = options.enums === String ? $root.google.cloud.tpu.v2.AttachedDisk.DiskMode[message.mode] === undefined ? message.mode : $root.google.cloud.tpu.v2.AttachedDisk.DiskMode[message.mode] : message.mode; return object; }; /** * Converts this AttachedDisk to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @instance * @returns {Object.} JSON object */ @@ -7834,7 +7834,7 @@ /** * Gets the default type url for AttachedDisk * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @memberof google.cloud.tpu.v2.AttachedDisk * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -7843,12 +7843,12 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AttachedDisk"; + return typeUrlPrefix + "/google.cloud.tpu.v2.AttachedDisk"; }; /** * DiskMode enum. - * @name google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode + * @name google.cloud.tpu.v2.AttachedDisk.DiskMode * @enum {number} * @property {number} DISK_MODE_UNSPECIFIED=0 DISK_MODE_UNSPECIFIED value * @property {number} READ_WRITE=1 READ_WRITE value @@ -7865,11 +7865,11 @@ return AttachedDisk; })(); - v2alpha1.SchedulingConfig = (function() { + v2.SchedulingConfig = (function() { /** * Properties of a SchedulingConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface ISchedulingConfig * @property {boolean|null} [preemptible] SchedulingConfig preemptible * @property {boolean|null} [reserved] SchedulingConfig reserved @@ -7877,11 +7877,11 @@ /** * Constructs a new SchedulingConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a SchedulingConfig. * @implements ISchedulingConfig * @constructor - * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set + * @param {google.cloud.tpu.v2.ISchedulingConfig=} [properties] Properties to set */ function SchedulingConfig(properties) { if (properties) @@ -7893,7 +7893,7 @@ /** * SchedulingConfig preemptible. * @member {boolean} preemptible - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @instance */ SchedulingConfig.prototype.preemptible = false; @@ -7901,7 +7901,7 @@ /** * SchedulingConfig reserved. * @member {boolean} reserved - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @instance */ SchedulingConfig.prototype.reserved = false; @@ -7909,21 +7909,21 @@ /** * Creates a new SchedulingConfig instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static - * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig instance + * @param {google.cloud.tpu.v2.ISchedulingConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.SchedulingConfig} SchedulingConfig instance */ SchedulingConfig.create = function create(properties) { return new SchedulingConfig(properties); }; /** - * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2.SchedulingConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static - * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {google.cloud.tpu.v2.ISchedulingConfig} message SchedulingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7938,11 +7938,11 @@ }; /** - * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.SchedulingConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static - * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {google.cloud.tpu.v2.ISchedulingConfig} message SchedulingConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -7953,18 +7953,18 @@ /** * Decodes a SchedulingConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @returns {google.cloud.tpu.v2.SchedulingConfig} SchedulingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ SchedulingConfig.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.cloud.tpu.v2alpha1.SchedulingConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.SchedulingConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -7987,10 +7987,10 @@ /** * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @returns {google.cloud.tpu.v2.SchedulingConfig} SchedulingConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -8003,7 +8003,7 @@ /** * Verifies a SchedulingConfig message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -8023,15 +8023,15 @@ /** * Creates a SchedulingConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @returns {google.cloud.tpu.v2.SchedulingConfig} SchedulingConfig */ SchedulingConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.SchedulingConfig) + if (object instanceof $root.google.cloud.tpu.v2.SchedulingConfig) return object; - var message = new $root.google.cloud.tpu.v2alpha1.SchedulingConfig(); + var message = new $root.google.cloud.tpu.v2.SchedulingConfig(); if (object.preemptible != null) message.preemptible = Boolean(object.preemptible); if (object.reserved != null) @@ -8042,9 +8042,9 @@ /** * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static - * @param {google.cloud.tpu.v2alpha1.SchedulingConfig} message SchedulingConfig + * @param {google.cloud.tpu.v2.SchedulingConfig} message SchedulingConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -8066,7 +8066,7 @@ /** * Converts this SchedulingConfig to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @instance * @returns {Object.} JSON object */ @@ -8077,7 +8077,7 @@ /** * Gets the default type url for SchedulingConfig * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @memberof google.cloud.tpu.v2.SchedulingConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -8086,30 +8086,30 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.SchedulingConfig"; + return typeUrlPrefix + "/google.cloud.tpu.v2.SchedulingConfig"; }; return SchedulingConfig; })(); - v2alpha1.NetworkEndpoint = (function() { + v2.NetworkEndpoint = (function() { /** * Properties of a NetworkEndpoint. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface INetworkEndpoint * @property {string|null} [ipAddress] NetworkEndpoint ipAddress * @property {number|null} [port] NetworkEndpoint port - * @property {google.cloud.tpu.v2alpha1.IAccessConfig|null} [accessConfig] NetworkEndpoint accessConfig + * @property {google.cloud.tpu.v2.IAccessConfig|null} [accessConfig] NetworkEndpoint accessConfig */ /** * Constructs a new NetworkEndpoint. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a NetworkEndpoint. * @implements INetworkEndpoint * @constructor - * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set + * @param {google.cloud.tpu.v2.INetworkEndpoint=} [properties] Properties to set */ function NetworkEndpoint(properties) { if (properties) @@ -8121,7 +8121,7 @@ /** * NetworkEndpoint ipAddress. * @member {string} ipAddress - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @instance */ NetworkEndpoint.prototype.ipAddress = ""; @@ -8129,15 +8129,15 @@ /** * NetworkEndpoint port. * @member {number} port - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @instance */ NetworkEndpoint.prototype.port = 0; /** * NetworkEndpoint accessConfig. - * @member {google.cloud.tpu.v2alpha1.IAccessConfig|null|undefined} accessConfig - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @member {google.cloud.tpu.v2.IAccessConfig|null|undefined} accessConfig + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @instance */ NetworkEndpoint.prototype.accessConfig = null; @@ -8145,21 +8145,21 @@ /** * Creates a new NetworkEndpoint instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static - * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint instance + * @param {google.cloud.tpu.v2.INetworkEndpoint=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.NetworkEndpoint} NetworkEndpoint instance */ NetworkEndpoint.create = function create(properties) { return new NetworkEndpoint(properties); }; /** - * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2.NetworkEndpoint.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static - * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {google.cloud.tpu.v2.INetworkEndpoint} message NetworkEndpoint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8171,16 +8171,16 @@ if (message.port != null && Object.hasOwnProperty.call(message, "port")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.port); if (message.accessConfig != null && Object.hasOwnProperty.call(message, "accessConfig")) - $root.google.cloud.tpu.v2alpha1.AccessConfig.encode(message.accessConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.cloud.tpu.v2.AccessConfig.encode(message.accessConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.NetworkEndpoint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static - * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {google.cloud.tpu.v2.INetworkEndpoint} message NetworkEndpoint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8191,18 +8191,18 @@ /** * Decodes a NetworkEndpoint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @returns {google.cloud.tpu.v2.NetworkEndpoint} NetworkEndpoint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NetworkEndpoint.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.cloud.tpu.v2alpha1.NetworkEndpoint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.NetworkEndpoint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -8215,7 +8215,7 @@ break; } case 5: { - message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.decode(reader, reader.uint32()); + message.accessConfig = $root.google.cloud.tpu.v2.AccessConfig.decode(reader, reader.uint32()); break; } default: @@ -8229,10 +8229,10 @@ /** * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @returns {google.cloud.tpu.v2.NetworkEndpoint} NetworkEndpoint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -8245,7 +8245,7 @@ /** * Verifies a NetworkEndpoint message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -8260,7 +8260,7 @@ if (!$util.isInteger(message.port)) return "port: integer expected"; if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) { - var error = $root.google.cloud.tpu.v2alpha1.AccessConfig.verify(message.accessConfig); + var error = $root.google.cloud.tpu.v2.AccessConfig.verify(message.accessConfig); if (error) return "accessConfig." + error; } @@ -8270,23 +8270,23 @@ /** * Creates a NetworkEndpoint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @returns {google.cloud.tpu.v2.NetworkEndpoint} NetworkEndpoint */ NetworkEndpoint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkEndpoint) + if (object instanceof $root.google.cloud.tpu.v2.NetworkEndpoint) return object; - var message = new $root.google.cloud.tpu.v2alpha1.NetworkEndpoint(); + var message = new $root.google.cloud.tpu.v2.NetworkEndpoint(); if (object.ipAddress != null) message.ipAddress = String(object.ipAddress); if (object.port != null) message.port = object.port | 0; if (object.accessConfig != null) { if (typeof object.accessConfig !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.NetworkEndpoint.accessConfig: object expected"); - message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.fromObject(object.accessConfig); + throw TypeError(".google.cloud.tpu.v2.NetworkEndpoint.accessConfig: object expected"); + message.accessConfig = $root.google.cloud.tpu.v2.AccessConfig.fromObject(object.accessConfig); } return message; }; @@ -8294,9 +8294,9 @@ /** * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static - * @param {google.cloud.tpu.v2alpha1.NetworkEndpoint} message NetworkEndpoint + * @param {google.cloud.tpu.v2.NetworkEndpoint} message NetworkEndpoint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -8314,14 +8314,14 @@ if (message.port != null && message.hasOwnProperty("port")) object.port = message.port; if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) - object.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.toObject(message.accessConfig, options); + object.accessConfig = $root.google.cloud.tpu.v2.AccessConfig.toObject(message.accessConfig, options); return object; }; /** * Converts this NetworkEndpoint to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @instance * @returns {Object.} JSON object */ @@ -8332,7 +8332,7 @@ /** * Gets the default type url for NetworkEndpoint * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @memberof google.cloud.tpu.v2.NetworkEndpoint * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -8341,28 +8341,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.NetworkEndpoint"; + return typeUrlPrefix + "/google.cloud.tpu.v2.NetworkEndpoint"; }; return NetworkEndpoint; })(); - v2alpha1.AccessConfig = (function() { + v2.AccessConfig = (function() { /** * Properties of an AccessConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IAccessConfig * @property {string|null} [externalIp] AccessConfig externalIp */ /** * Constructs a new AccessConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents an AccessConfig. * @implements IAccessConfig * @constructor - * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IAccessConfig=} [properties] Properties to set */ function AccessConfig(properties) { if (properties) @@ -8374,7 +8374,7 @@ /** * AccessConfig externalIp. * @member {string} externalIp - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @instance */ AccessConfig.prototype.externalIp = ""; @@ -8382,21 +8382,21 @@ /** * Creates a new AccessConfig instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static - * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig instance + * @param {google.cloud.tpu.v2.IAccessConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.AccessConfig} AccessConfig instance */ AccessConfig.create = function create(properties) { return new AccessConfig(properties); }; /** - * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2.AccessConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static - * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {google.cloud.tpu.v2.IAccessConfig} message AccessConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8409,11 +8409,11 @@ }; /** - * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AccessConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static - * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {google.cloud.tpu.v2.IAccessConfig} message AccessConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8424,18 +8424,18 @@ /** * Decodes an AccessConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @returns {google.cloud.tpu.v2.AccessConfig} AccessConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ AccessConfig.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.cloud.tpu.v2alpha1.AccessConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.AccessConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -8454,10 +8454,10 @@ /** * Decodes an AccessConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @returns {google.cloud.tpu.v2.AccessConfig} AccessConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -8470,7 +8470,7 @@ /** * Verifies an AccessConfig message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -8487,15 +8487,15 @@ /** * Creates an AccessConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @returns {google.cloud.tpu.v2.AccessConfig} AccessConfig */ AccessConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.AccessConfig) + if (object instanceof $root.google.cloud.tpu.v2.AccessConfig) return object; - var message = new $root.google.cloud.tpu.v2alpha1.AccessConfig(); + var message = new $root.google.cloud.tpu.v2.AccessConfig(); if (object.externalIp != null) message.externalIp = String(object.externalIp); return message; @@ -8504,9 +8504,9 @@ /** * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static - * @param {google.cloud.tpu.v2alpha1.AccessConfig} message AccessConfig + * @param {google.cloud.tpu.v2.AccessConfig} message AccessConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -8524,7 +8524,7 @@ /** * Converts this AccessConfig to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @instance * @returns {Object.} JSON object */ @@ -8535,7 +8535,7 @@ /** * Gets the default type url for AccessConfig * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @memberof google.cloud.tpu.v2.AccessConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -8544,30 +8544,31 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AccessConfig"; + return typeUrlPrefix + "/google.cloud.tpu.v2.AccessConfig"; }; return AccessConfig; })(); - v2alpha1.NetworkConfig = (function() { + v2.NetworkConfig = (function() { /** * Properties of a NetworkConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface INetworkConfig * @property {string|null} [network] NetworkConfig network * @property {string|null} [subnetwork] NetworkConfig subnetwork * @property {boolean|null} [enableExternalIps] NetworkConfig enableExternalIps + * @property {boolean|null} [canIpForward] NetworkConfig canIpForward */ /** * Constructs a new NetworkConfig. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a NetworkConfig. * @implements INetworkConfig * @constructor - * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set + * @param {google.cloud.tpu.v2.INetworkConfig=} [properties] Properties to set */ function NetworkConfig(properties) { if (properties) @@ -8579,7 +8580,7 @@ /** * NetworkConfig network. * @member {string} network - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @instance */ NetworkConfig.prototype.network = ""; @@ -8587,7 +8588,7 @@ /** * NetworkConfig subnetwork. * @member {string} subnetwork - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @instance */ NetworkConfig.prototype.subnetwork = ""; @@ -8595,29 +8596,37 @@ /** * NetworkConfig enableExternalIps. * @member {boolean} enableExternalIps - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @instance */ NetworkConfig.prototype.enableExternalIps = false; + /** + * NetworkConfig canIpForward. + * @member {boolean} canIpForward + * @memberof google.cloud.tpu.v2.NetworkConfig + * @instance + */ + NetworkConfig.prototype.canIpForward = false; + /** * Creates a new NetworkConfig instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static - * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig instance + * @param {google.cloud.tpu.v2.INetworkConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.NetworkConfig} NetworkConfig instance */ NetworkConfig.create = function create(properties) { return new NetworkConfig(properties); }; /** - * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2.NetworkConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static - * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {google.cloud.tpu.v2.INetworkConfig} message NetworkConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8630,15 +8639,17 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.subnetwork); if (message.enableExternalIps != null && Object.hasOwnProperty.call(message, "enableExternalIps")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableExternalIps); + if (message.canIpForward != null && Object.hasOwnProperty.call(message, "canIpForward")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.canIpForward); return writer; }; /** - * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.NetworkConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static - * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {google.cloud.tpu.v2.INetworkConfig} message NetworkConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8649,18 +8660,18 @@ /** * Decodes a NetworkConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @returns {google.cloud.tpu.v2.NetworkConfig} NetworkConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NetworkConfig.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.cloud.tpu.v2alpha1.NetworkConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.NetworkConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -8676,6 +8687,10 @@ message.enableExternalIps = reader.bool(); break; } + case 4: { + message.canIpForward = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -8687,10 +8702,10 @@ /** * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @returns {google.cloud.tpu.v2.NetworkConfig} NetworkConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -8703,7 +8718,7 @@ /** * Verifies a NetworkConfig message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -8720,36 +8735,41 @@ if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) if (typeof message.enableExternalIps !== "boolean") return "enableExternalIps: boolean expected"; + if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) + if (typeof message.canIpForward !== "boolean") + return "canIpForward: boolean expected"; return null; }; /** * Creates a NetworkConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @returns {google.cloud.tpu.v2.NetworkConfig} NetworkConfig */ NetworkConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkConfig) + if (object instanceof $root.google.cloud.tpu.v2.NetworkConfig) return object; - var message = new $root.google.cloud.tpu.v2alpha1.NetworkConfig(); + var message = new $root.google.cloud.tpu.v2.NetworkConfig(); if (object.network != null) message.network = String(object.network); if (object.subnetwork != null) message.subnetwork = String(object.subnetwork); if (object.enableExternalIps != null) message.enableExternalIps = Boolean(object.enableExternalIps); + if (object.canIpForward != null) + message.canIpForward = Boolean(object.canIpForward); return message; }; /** * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static - * @param {google.cloud.tpu.v2alpha1.NetworkConfig} message NetworkConfig + * @param {google.cloud.tpu.v2.NetworkConfig} message NetworkConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -8761,6 +8781,7 @@ object.network = ""; object.subnetwork = ""; object.enableExternalIps = false; + object.canIpForward = false; } if (message.network != null && message.hasOwnProperty("network")) object.network = message.network; @@ -8768,13 +8789,15 @@ object.subnetwork = message.subnetwork; if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) object.enableExternalIps = message.enableExternalIps; + if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) + object.canIpForward = message.canIpForward; return object; }; /** * Converts this NetworkConfig to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @instance * @returns {Object.} JSON object */ @@ -8785,7 +8808,7 @@ /** * Gets the default type url for NetworkConfig * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @memberof google.cloud.tpu.v2.NetworkConfig * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -8794,17 +8817,17 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.NetworkConfig"; + return typeUrlPrefix + "/google.cloud.tpu.v2.NetworkConfig"; }; return NetworkConfig; })(); - v2alpha1.ServiceAccount = (function() { + v2.ServiceAccount = (function() { /** * Properties of a ServiceAccount. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IServiceAccount * @property {string|null} [email] ServiceAccount email * @property {Array.|null} [scope] ServiceAccount scope @@ -8812,11 +8835,11 @@ /** * Constructs a new ServiceAccount. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ServiceAccount. * @implements IServiceAccount * @constructor - * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IServiceAccount=} [properties] Properties to set */ function ServiceAccount(properties) { this.scope = []; @@ -8829,7 +8852,7 @@ /** * ServiceAccount email. * @member {string} email - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @instance */ ServiceAccount.prototype.email = ""; @@ -8837,7 +8860,7 @@ /** * ServiceAccount scope. * @member {Array.} scope - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @instance */ ServiceAccount.prototype.scope = $util.emptyArray; @@ -8845,21 +8868,21 @@ /** * Creates a new ServiceAccount instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static - * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount instance + * @param {google.cloud.tpu.v2.IServiceAccount=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ServiceAccount} ServiceAccount instance */ ServiceAccount.create = function create(properties) { return new ServiceAccount(properties); }; /** - * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2.ServiceAccount.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static - * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {google.cloud.tpu.v2.IServiceAccount} message ServiceAccount message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8875,11 +8898,11 @@ }; /** - * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ServiceAccount.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static - * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {google.cloud.tpu.v2.IServiceAccount} message ServiceAccount message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -8890,18 +8913,18 @@ /** * Decodes a ServiceAccount message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @returns {google.cloud.tpu.v2.ServiceAccount} ServiceAccount * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ServiceAccount.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.cloud.tpu.v2alpha1.ServiceAccount(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ServiceAccount(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -8926,10 +8949,10 @@ /** * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @returns {google.cloud.tpu.v2.ServiceAccount} ServiceAccount * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -8942,7 +8965,7 @@ /** * Verifies a ServiceAccount message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -8966,20 +8989,20 @@ /** * Creates a ServiceAccount message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @returns {google.cloud.tpu.v2.ServiceAccount} ServiceAccount */ ServiceAccount.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceAccount) + if (object instanceof $root.google.cloud.tpu.v2.ServiceAccount) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ServiceAccount(); + var message = new $root.google.cloud.tpu.v2.ServiceAccount(); if (object.email != null) message.email = String(object.email); if (object.scope) { if (!Array.isArray(object.scope)) - throw TypeError(".google.cloud.tpu.v2alpha1.ServiceAccount.scope: array expected"); + throw TypeError(".google.cloud.tpu.v2.ServiceAccount.scope: array expected"); message.scope = []; for (var i = 0; i < object.scope.length; ++i) message.scope[i] = String(object.scope[i]); @@ -8990,9 +9013,9 @@ /** * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static - * @param {google.cloud.tpu.v2alpha1.ServiceAccount} message ServiceAccount + * @param {google.cloud.tpu.v2.ServiceAccount} message ServiceAccount * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -9017,7 +9040,7 @@ /** * Converts this ServiceAccount to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @instance * @returns {Object.} JSON object */ @@ -9028,7 +9051,7 @@ /** * Gets the default type url for ServiceAccount * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @memberof google.cloud.tpu.v2.ServiceAccount * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -9037,48 +9060,48 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ServiceAccount"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ServiceAccount"; }; return ServiceAccount; })(); - v2alpha1.Node = (function() { + v2.Node = (function() { /** * Properties of a Node. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface INode * @property {string|null} [name] Node name * @property {string|null} [description] Node description * @property {string|null} [acceleratorType] Node acceleratorType - * @property {google.cloud.tpu.v2alpha1.Node.State|null} [state] Node state + * @property {google.cloud.tpu.v2.Node.State|null} [state] Node state * @property {string|null} [healthDescription] Node healthDescription * @property {string|null} [runtimeVersion] Node runtimeVersion - * @property {google.cloud.tpu.v2alpha1.INetworkConfig|null} [networkConfig] Node networkConfig + * @property {google.cloud.tpu.v2.INetworkConfig|null} [networkConfig] Node networkConfig * @property {string|null} [cidrBlock] Node cidrBlock - * @property {google.cloud.tpu.v2alpha1.IServiceAccount|null} [serviceAccount] Node serviceAccount + * @property {google.cloud.tpu.v2.IServiceAccount|null} [serviceAccount] Node serviceAccount * @property {google.protobuf.ITimestamp|null} [createTime] Node createTime - * @property {google.cloud.tpu.v2alpha1.ISchedulingConfig|null} [schedulingConfig] Node schedulingConfig - * @property {Array.|null} [networkEndpoints] Node networkEndpoints - * @property {google.cloud.tpu.v2alpha1.Node.Health|null} [health] Node health + * @property {google.cloud.tpu.v2.ISchedulingConfig|null} [schedulingConfig] Node schedulingConfig + * @property {Array.|null} [networkEndpoints] Node networkEndpoints + * @property {google.cloud.tpu.v2.Node.Health|null} [health] Node health * @property {Object.|null} [labels] Node labels * @property {Object.|null} [metadata] Node metadata * @property {Array.|null} [tags] Node tags * @property {number|Long|null} [id] Node id - * @property {Array.|null} [dataDisks] Node dataDisks - * @property {google.cloud.tpu.v2alpha1.Node.ApiVersion|null} [apiVersion] Node apiVersion - * @property {Array.|null} [symptoms] Node symptoms - * @property {google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null} [shieldedInstanceConfig] Node shieldedInstanceConfig + * @property {Array.|null} [dataDisks] Node dataDisks + * @property {google.cloud.tpu.v2.Node.ApiVersion|null} [apiVersion] Node apiVersion + * @property {Array.|null} [symptoms] Node symptoms + * @property {google.cloud.tpu.v2.IShieldedInstanceConfig|null} [shieldedInstanceConfig] Node shieldedInstanceConfig */ /** * Constructs a new Node. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a Node. * @implements INode * @constructor - * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set + * @param {google.cloud.tpu.v2.INode=} [properties] Properties to set */ function Node(properties) { this.networkEndpoints = []; @@ -9096,7 +9119,7 @@ /** * Node name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.name = ""; @@ -9104,7 +9127,7 @@ /** * Node description. * @member {string} description - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.description = ""; @@ -9112,15 +9135,15 @@ /** * Node acceleratorType. * @member {string} acceleratorType - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.acceleratorType = ""; /** * Node state. - * @member {google.cloud.tpu.v2alpha1.Node.State} state - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.Node.State} state + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.state = 0; @@ -9128,7 +9151,7 @@ /** * Node healthDescription. * @member {string} healthDescription - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.healthDescription = ""; @@ -9136,15 +9159,15 @@ /** * Node runtimeVersion. * @member {string} runtimeVersion - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.runtimeVersion = ""; /** * Node networkConfig. - * @member {google.cloud.tpu.v2alpha1.INetworkConfig|null|undefined} networkConfig - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.INetworkConfig|null|undefined} networkConfig + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.networkConfig = null; @@ -9152,15 +9175,15 @@ /** * Node cidrBlock. * @member {string} cidrBlock - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.cidrBlock = ""; /** * Node serviceAccount. - * @member {google.cloud.tpu.v2alpha1.IServiceAccount|null|undefined} serviceAccount - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.IServiceAccount|null|undefined} serviceAccount + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.serviceAccount = null; @@ -9168,31 +9191,31 @@ /** * Node createTime. * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.createTime = null; /** * Node schedulingConfig. - * @member {google.cloud.tpu.v2alpha1.ISchedulingConfig|null|undefined} schedulingConfig - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.ISchedulingConfig|null|undefined} schedulingConfig + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.schedulingConfig = null; /** * Node networkEndpoints. - * @member {Array.} networkEndpoints - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {Array.} networkEndpoints + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.networkEndpoints = $util.emptyArray; /** * Node health. - * @member {google.cloud.tpu.v2alpha1.Node.Health} health - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.Node.Health} health + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.health = 0; @@ -9200,7 +9223,7 @@ /** * Node labels. * @member {Object.} labels - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.labels = $util.emptyObject; @@ -9208,7 +9231,7 @@ /** * Node metadata. * @member {Object.} metadata - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.metadata = $util.emptyObject; @@ -9216,7 +9239,7 @@ /** * Node tags. * @member {Array.} tags - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.tags = $util.emptyArray; @@ -9224,39 +9247,39 @@ /** * Node id. * @member {number|Long} id - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** * Node dataDisks. - * @member {Array.} dataDisks - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {Array.} dataDisks + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.dataDisks = $util.emptyArray; /** * Node apiVersion. - * @member {google.cloud.tpu.v2alpha1.Node.ApiVersion} apiVersion - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.Node.ApiVersion} apiVersion + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.apiVersion = 0; /** * Node symptoms. - * @member {Array.} symptoms - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {Array.} symptoms + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.symptoms = $util.emptyArray; /** * Node shieldedInstanceConfig. - * @member {google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null|undefined} shieldedInstanceConfig - * @memberof google.cloud.tpu.v2alpha1.Node + * @member {google.cloud.tpu.v2.IShieldedInstanceConfig|null|undefined} shieldedInstanceConfig + * @memberof google.cloud.tpu.v2.Node * @instance */ Node.prototype.shieldedInstanceConfig = null; @@ -9264,21 +9287,21 @@ /** * Creates a new Node instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static - * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.Node} Node instance + * @param {google.cloud.tpu.v2.INode=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.Node} Node instance */ Node.create = function create(properties) { return new Node(properties); }; /** - * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2.Node.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static - * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {google.cloud.tpu.v2.INode} message Node message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -9302,10 +9325,10 @@ if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); if (message.schedulingConfig != null && Object.hasOwnProperty.call(message, "schedulingConfig")) - $root.google.cloud.tpu.v2alpha1.SchedulingConfig.encode(message.schedulingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + $root.google.cloud.tpu.v2.SchedulingConfig.encode(message.schedulingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); if (message.networkEndpoints != null && message.networkEndpoints.length) for (var i = 0; i < message.networkEndpoints.length; ++i) - $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.encode(message.networkEndpoints[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + $root.google.cloud.tpu.v2.NetworkEndpoint.encode(message.networkEndpoints[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); if (message.health != null && Object.hasOwnProperty.call(message, "health")) writer.uint32(/* id 22, wireType 0 =*/176).int32(message.health); if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) @@ -9317,31 +9340,31 @@ for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); if (message.networkConfig != null && Object.hasOwnProperty.call(message, "networkConfig")) - $root.google.cloud.tpu.v2alpha1.NetworkConfig.encode(message.networkConfig, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); + $root.google.cloud.tpu.v2.NetworkConfig.encode(message.networkConfig, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) - $root.google.cloud.tpu.v2alpha1.ServiceAccount.encode(message.serviceAccount, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + $root.google.cloud.tpu.v2.ServiceAccount.encode(message.serviceAccount, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) writer.uint32(/* id 38, wireType 0 =*/304).int32(message.apiVersion); if (message.symptoms != null && message.symptoms.length) for (var i = 0; i < message.symptoms.length; ++i) - $root.google.cloud.tpu.v2alpha1.Symptom.encode(message.symptoms[i], writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + $root.google.cloud.tpu.v2.Symptom.encode(message.symptoms[i], writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); if (message.tags != null && message.tags.length) for (var i = 0; i < message.tags.length; ++i) writer.uint32(/* id 40, wireType 2 =*/322).string(message.tags[i]); if (message.dataDisks != null && message.dataDisks.length) for (var i = 0; i < message.dataDisks.length; ++i) - $root.google.cloud.tpu.v2alpha1.AttachedDisk.encode(message.dataDisks[i], writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + $root.google.cloud.tpu.v2.AttachedDisk.encode(message.dataDisks[i], writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); if (message.shieldedInstanceConfig != null && Object.hasOwnProperty.call(message, "shieldedInstanceConfig")) - $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.encode(message.shieldedInstanceConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + $root.google.cloud.tpu.v2.ShieldedInstanceConfig.encode(message.shieldedInstanceConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); return writer; }; /** - * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.Node.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static - * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {google.cloud.tpu.v2.INode} message Node message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -9352,18 +9375,18 @@ /** * Decodes a Node message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @returns {google.cloud.tpu.v2.Node} Node * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Node.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.cloud.tpu.v2alpha1.Node(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.Node(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -9392,7 +9415,7 @@ break; } case 36: { - message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.decode(reader, reader.uint32()); + message.networkConfig = $root.google.cloud.tpu.v2.NetworkConfig.decode(reader, reader.uint32()); break; } case 13: { @@ -9400,7 +9423,7 @@ break; } case 37: { - message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.decode(reader, reader.uint32()); + message.serviceAccount = $root.google.cloud.tpu.v2.ServiceAccount.decode(reader, reader.uint32()); break; } case 16: { @@ -9408,13 +9431,13 @@ break; } case 17: { - message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.decode(reader, reader.uint32()); + message.schedulingConfig = $root.google.cloud.tpu.v2.SchedulingConfig.decode(reader, reader.uint32()); break; } case 21: { if (!(message.networkEndpoints && message.networkEndpoints.length)) message.networkEndpoints = []; - message.networkEndpoints.push($root.google.cloud.tpu.v2alpha1.NetworkEndpoint.decode(reader, reader.uint32())); + message.networkEndpoints.push($root.google.cloud.tpu.v2.NetworkEndpoint.decode(reader, reader.uint32())); break; } case 22: { @@ -9480,7 +9503,7 @@ case 41: { if (!(message.dataDisks && message.dataDisks.length)) message.dataDisks = []; - message.dataDisks.push($root.google.cloud.tpu.v2alpha1.AttachedDisk.decode(reader, reader.uint32())); + message.dataDisks.push($root.google.cloud.tpu.v2.AttachedDisk.decode(reader, reader.uint32())); break; } case 38: { @@ -9490,11 +9513,11 @@ case 39: { if (!(message.symptoms && message.symptoms.length)) message.symptoms = []; - message.symptoms.push($root.google.cloud.tpu.v2alpha1.Symptom.decode(reader, reader.uint32())); + message.symptoms.push($root.google.cloud.tpu.v2.Symptom.decode(reader, reader.uint32())); break; } case 45: { - message.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.decode(reader, reader.uint32()); + message.shieldedInstanceConfig = $root.google.cloud.tpu.v2.ShieldedInstanceConfig.decode(reader, reader.uint32()); break; } default: @@ -9508,10 +9531,10 @@ /** * Decodes a Node message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @returns {google.cloud.tpu.v2.Node} Node * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -9524,7 +9547,7 @@ /** * Verifies a Node message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -9569,7 +9592,7 @@ if (!$util.isString(message.runtimeVersion)) return "runtimeVersion: string expected"; if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) { - var error = $root.google.cloud.tpu.v2alpha1.NetworkConfig.verify(message.networkConfig); + var error = $root.google.cloud.tpu.v2.NetworkConfig.verify(message.networkConfig); if (error) return "networkConfig." + error; } @@ -9577,7 +9600,7 @@ if (!$util.isString(message.cidrBlock)) return "cidrBlock: string expected"; if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) { - var error = $root.google.cloud.tpu.v2alpha1.ServiceAccount.verify(message.serviceAccount); + var error = $root.google.cloud.tpu.v2.ServiceAccount.verify(message.serviceAccount); if (error) return "serviceAccount." + error; } @@ -9587,7 +9610,7 @@ return "createTime." + error; } if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) { - var error = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.verify(message.schedulingConfig); + var error = $root.google.cloud.tpu.v2.SchedulingConfig.verify(message.schedulingConfig); if (error) return "schedulingConfig." + error; } @@ -9595,7 +9618,7 @@ if (!Array.isArray(message.networkEndpoints)) return "networkEndpoints: array expected"; for (var i = 0; i < message.networkEndpoints.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.verify(message.networkEndpoints[i]); + var error = $root.google.cloud.tpu.v2.NetworkEndpoint.verify(message.networkEndpoints[i]); if (error) return "networkEndpoints." + error; } @@ -9641,7 +9664,7 @@ if (!Array.isArray(message.dataDisks)) return "dataDisks: array expected"; for (var i = 0; i < message.dataDisks.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.AttachedDisk.verify(message.dataDisks[i]); + var error = $root.google.cloud.tpu.v2.AttachedDisk.verify(message.dataDisks[i]); if (error) return "dataDisks." + error; } @@ -9654,19 +9677,20 @@ case 1: case 2: case 3: + case 4: break; } if (message.symptoms != null && message.hasOwnProperty("symptoms")) { if (!Array.isArray(message.symptoms)) return "symptoms: array expected"; for (var i = 0; i < message.symptoms.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.Symptom.verify(message.symptoms[i]); + var error = $root.google.cloud.tpu.v2.Symptom.verify(message.symptoms[i]); if (error) return "symptoms." + error; } } if (message.shieldedInstanceConfig != null && message.hasOwnProperty("shieldedInstanceConfig")) { - var error = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify(message.shieldedInstanceConfig); + var error = $root.google.cloud.tpu.v2.ShieldedInstanceConfig.verify(message.shieldedInstanceConfig); if (error) return "shieldedInstanceConfig." + error; } @@ -9676,15 +9700,15 @@ /** * Creates a Node message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @returns {google.cloud.tpu.v2.Node} Node */ Node.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.Node) + if (object instanceof $root.google.cloud.tpu.v2.Node) return object; - var message = new $root.google.cloud.tpu.v2alpha1.Node(); + var message = new $root.google.cloud.tpu.v2.Node(); if (object.name != null) message.name = String(object.name); if (object.description != null) @@ -9765,34 +9789,34 @@ message.runtimeVersion = String(object.runtimeVersion); if (object.networkConfig != null) { if (typeof object.networkConfig !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfig: object expected"); - message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.fromObject(object.networkConfig); + throw TypeError(".google.cloud.tpu.v2.Node.networkConfig: object expected"); + message.networkConfig = $root.google.cloud.tpu.v2.NetworkConfig.fromObject(object.networkConfig); } if (object.cidrBlock != null) message.cidrBlock = String(object.cidrBlock); if (object.serviceAccount != null) { if (typeof object.serviceAccount !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.serviceAccount: object expected"); - message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.fromObject(object.serviceAccount); + throw TypeError(".google.cloud.tpu.v2.Node.serviceAccount: object expected"); + message.serviceAccount = $root.google.cloud.tpu.v2.ServiceAccount.fromObject(object.serviceAccount); } if (object.createTime != null) { if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.createTime: object expected"); + throw TypeError(".google.cloud.tpu.v2.Node.createTime: object expected"); message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } if (object.schedulingConfig != null) { if (typeof object.schedulingConfig !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.schedulingConfig: object expected"); - message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.fromObject(object.schedulingConfig); + throw TypeError(".google.cloud.tpu.v2.Node.schedulingConfig: object expected"); + message.schedulingConfig = $root.google.cloud.tpu.v2.SchedulingConfig.fromObject(object.schedulingConfig); } if (object.networkEndpoints) { if (!Array.isArray(object.networkEndpoints)) - throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: array expected"); + throw TypeError(".google.cloud.tpu.v2.Node.networkEndpoints: array expected"); message.networkEndpoints = []; for (var i = 0; i < object.networkEndpoints.length; ++i) { if (typeof object.networkEndpoints[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: object expected"); - message.networkEndpoints[i] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.fromObject(object.networkEndpoints[i]); + throw TypeError(".google.cloud.tpu.v2.Node.networkEndpoints: object expected"); + message.networkEndpoints[i] = $root.google.cloud.tpu.v2.NetworkEndpoint.fromObject(object.networkEndpoints[i]); } } switch (object.health) { @@ -9825,21 +9849,21 @@ } if (object.labels) { if (typeof object.labels !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.labels: object expected"); + throw TypeError(".google.cloud.tpu.v2.Node.labels: object expected"); message.labels = {}; for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) message.labels[keys[i]] = String(object.labels[keys[i]]); } if (object.metadata) { if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.metadata: object expected"); + throw TypeError(".google.cloud.tpu.v2.Node.metadata: object expected"); message.metadata = {}; for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) message.metadata[keys[i]] = String(object.metadata[keys[i]]); } if (object.tags) { if (!Array.isArray(object.tags)) - throw TypeError(".google.cloud.tpu.v2alpha1.Node.tags: array expected"); + throw TypeError(".google.cloud.tpu.v2.Node.tags: array expected"); message.tags = []; for (var i = 0; i < object.tags.length; ++i) message.tags[i] = String(object.tags[i]); @@ -9855,12 +9879,12 @@ message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); if (object.dataDisks) { if (!Array.isArray(object.dataDisks)) - throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: array expected"); + throw TypeError(".google.cloud.tpu.v2.Node.dataDisks: array expected"); message.dataDisks = []; for (var i = 0; i < object.dataDisks.length; ++i) { if (typeof object.dataDisks[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: object expected"); - message.dataDisks[i] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.fromObject(object.dataDisks[i]); + throw TypeError(".google.cloud.tpu.v2.Node.dataDisks: object expected"); + message.dataDisks[i] = $root.google.cloud.tpu.v2.AttachedDisk.fromObject(object.dataDisks[i]); } } switch (object.apiVersion) { @@ -9886,21 +9910,25 @@ case 3: message.apiVersion = 3; break; + case "V2": + case 4: + message.apiVersion = 4; + break; } if (object.symptoms) { if (!Array.isArray(object.symptoms)) - throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: array expected"); + throw TypeError(".google.cloud.tpu.v2.Node.symptoms: array expected"); message.symptoms = []; for (var i = 0; i < object.symptoms.length; ++i) { if (typeof object.symptoms[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: object expected"); - message.symptoms[i] = $root.google.cloud.tpu.v2alpha1.Symptom.fromObject(object.symptoms[i]); + throw TypeError(".google.cloud.tpu.v2.Node.symptoms: object expected"); + message.symptoms[i] = $root.google.cloud.tpu.v2.Symptom.fromObject(object.symptoms[i]); } } if (object.shieldedInstanceConfig != null) { if (typeof object.shieldedInstanceConfig !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.Node.shieldedInstanceConfig: object expected"); - message.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.fromObject(object.shieldedInstanceConfig); + throw TypeError(".google.cloud.tpu.v2.Node.shieldedInstanceConfig: object expected"); + message.shieldedInstanceConfig = $root.google.cloud.tpu.v2.ShieldedInstanceConfig.fromObject(object.shieldedInstanceConfig); } return message; }; @@ -9908,9 +9936,9 @@ /** * Creates a plain object from a Node message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static - * @param {google.cloud.tpu.v2alpha1.Node} message Node + * @param {google.cloud.tpu.v2.Node} message Node * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -9956,7 +9984,7 @@ if (message.acceleratorType != null && message.hasOwnProperty("acceleratorType")) object.acceleratorType = message.acceleratorType; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.State[message.state] === undefined ? message.state : $root.google.cloud.tpu.v2alpha1.Node.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.tpu.v2.Node.State[message.state] === undefined ? message.state : $root.google.cloud.tpu.v2.Node.State[message.state] : message.state; if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) object.healthDescription = message.healthDescription; if (message.runtimeVersion != null && message.hasOwnProperty("runtimeVersion")) @@ -9966,14 +9994,14 @@ if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) - object.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.toObject(message.schedulingConfig, options); + object.schedulingConfig = $root.google.cloud.tpu.v2.SchedulingConfig.toObject(message.schedulingConfig, options); if (message.networkEndpoints && message.networkEndpoints.length) { object.networkEndpoints = []; for (var j = 0; j < message.networkEndpoints.length; ++j) - object.networkEndpoints[j] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.toObject(message.networkEndpoints[j], options); + object.networkEndpoints[j] = $root.google.cloud.tpu.v2.NetworkEndpoint.toObject(message.networkEndpoints[j], options); } if (message.health != null && message.hasOwnProperty("health")) - object.health = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.Health[message.health] === undefined ? message.health : $root.google.cloud.tpu.v2alpha1.Node.Health[message.health] : message.health; + object.health = options.enums === String ? $root.google.cloud.tpu.v2.Node.Health[message.health] === undefined ? message.health : $root.google.cloud.tpu.v2.Node.Health[message.health] : message.health; var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; @@ -9991,15 +10019,15 @@ object.metadata[keys2[j]] = message.metadata[keys2[j]]; } if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) - object.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.toObject(message.networkConfig, options); + object.networkConfig = $root.google.cloud.tpu.v2.NetworkConfig.toObject(message.networkConfig, options); if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) - object.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.toObject(message.serviceAccount, options); + object.serviceAccount = $root.google.cloud.tpu.v2.ServiceAccount.toObject(message.serviceAccount, options); if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) - object.apiVersion = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.ApiVersion[message.apiVersion] === undefined ? message.apiVersion : $root.google.cloud.tpu.v2alpha1.Node.ApiVersion[message.apiVersion] : message.apiVersion; + object.apiVersion = options.enums === String ? $root.google.cloud.tpu.v2.Node.ApiVersion[message.apiVersion] === undefined ? message.apiVersion : $root.google.cloud.tpu.v2.Node.ApiVersion[message.apiVersion] : message.apiVersion; if (message.symptoms && message.symptoms.length) { object.symptoms = []; for (var j = 0; j < message.symptoms.length; ++j) - object.symptoms[j] = $root.google.cloud.tpu.v2alpha1.Symptom.toObject(message.symptoms[j], options); + object.symptoms[j] = $root.google.cloud.tpu.v2.Symptom.toObject(message.symptoms[j], options); } if (message.tags && message.tags.length) { object.tags = []; @@ -10009,17 +10037,17 @@ if (message.dataDisks && message.dataDisks.length) { object.dataDisks = []; for (var j = 0; j < message.dataDisks.length; ++j) - object.dataDisks[j] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.toObject(message.dataDisks[j], options); + object.dataDisks[j] = $root.google.cloud.tpu.v2.AttachedDisk.toObject(message.dataDisks[j], options); } if (message.shieldedInstanceConfig != null && message.hasOwnProperty("shieldedInstanceConfig")) - object.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.toObject(message.shieldedInstanceConfig, options); + object.shieldedInstanceConfig = $root.google.cloud.tpu.v2.ShieldedInstanceConfig.toObject(message.shieldedInstanceConfig, options); return object; }; /** * Converts this Node to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @instance * @returns {Object.} JSON object */ @@ -10030,7 +10058,7 @@ /** * Gets the default type url for Node * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.Node + * @memberof google.cloud.tpu.v2.Node * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -10039,12 +10067,12 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.Node"; + return typeUrlPrefix + "/google.cloud.tpu.v2.Node"; }; /** * State enum. - * @name google.cloud.tpu.v2alpha1.Node.State + * @name google.cloud.tpu.v2.Node.State * @enum {number} * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value * @property {number} CREATING=1 CREATING value @@ -10084,7 +10112,7 @@ /** * Health enum. - * @name google.cloud.tpu.v2alpha1.Node.Health + * @name google.cloud.tpu.v2.Node.Health * @enum {number} * @property {number} HEALTH_UNSPECIFIED=0 HEALTH_UNSPECIFIED value * @property {number} HEALTHY=1 HEALTHY value @@ -10104,12 +10132,13 @@ /** * ApiVersion enum. - * @name google.cloud.tpu.v2alpha1.Node.ApiVersion + * @name google.cloud.tpu.v2.Node.ApiVersion * @enum {number} * @property {number} API_VERSION_UNSPECIFIED=0 API_VERSION_UNSPECIFIED value * @property {number} V1_ALPHA1=1 V1_ALPHA1 value * @property {number} V1=2 V1 value * @property {number} V2_ALPHA1=3 V2_ALPHA1 value + * @property {number} V2=4 V2 value */ Node.ApiVersion = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -10117,17 +10146,18 @@ values[valuesById[1] = "V1_ALPHA1"] = 1; values[valuesById[2] = "V1"] = 2; values[valuesById[3] = "V2_ALPHA1"] = 3; + values[valuesById[4] = "V2"] = 4; return values; })(); return Node; })(); - v2alpha1.ListNodesRequest = (function() { + v2.ListNodesRequest = (function() { /** * Properties of a ListNodesRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IListNodesRequest * @property {string|null} [parent] ListNodesRequest parent * @property {number|null} [pageSize] ListNodesRequest pageSize @@ -10136,11 +10166,11 @@ /** * Constructs a new ListNodesRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ListNodesRequest. * @implements IListNodesRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListNodesRequest=} [properties] Properties to set */ function ListNodesRequest(properties) { if (properties) @@ -10152,7 +10182,7 @@ /** * ListNodesRequest parent. * @member {string} parent - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @instance */ ListNodesRequest.prototype.parent = ""; @@ -10160,7 +10190,7 @@ /** * ListNodesRequest pageSize. * @member {number} pageSize - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @instance */ ListNodesRequest.prototype.pageSize = 0; @@ -10168,7 +10198,7 @@ /** * ListNodesRequest pageToken. * @member {string} pageToken - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @instance */ ListNodesRequest.prototype.pageToken = ""; @@ -10176,21 +10206,21 @@ /** * Creates a new ListNodesRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest instance + * @param {google.cloud.tpu.v2.IListNodesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListNodesRequest} ListNodesRequest instance */ ListNodesRequest.create = function create(properties) { return new ListNodesRequest(properties); }; /** - * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListNodesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListNodesRequest} message ListNodesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10207,11 +10237,11 @@ }; /** - * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListNodesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListNodesRequest} message ListNodesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10222,18 +10252,18 @@ /** * Decodes a ListNodesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @returns {google.cloud.tpu.v2.ListNodesRequest} ListNodesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ListNodesRequest.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.cloud.tpu.v2alpha1.ListNodesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListNodesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -10260,10 +10290,10 @@ /** * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @returns {google.cloud.tpu.v2.ListNodesRequest} ListNodesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -10276,7 +10306,7 @@ /** * Verifies a ListNodesRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -10299,15 +10329,15 @@ /** * Creates a ListNodesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @returns {google.cloud.tpu.v2.ListNodesRequest} ListNodesRequest */ ListNodesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesRequest) + if (object instanceof $root.google.cloud.tpu.v2.ListNodesRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListNodesRequest(); + var message = new $root.google.cloud.tpu.v2.ListNodesRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.pageSize != null) @@ -10320,9 +10350,9 @@ /** * Creates a plain object from a ListNodesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static - * @param {google.cloud.tpu.v2alpha1.ListNodesRequest} message ListNodesRequest + * @param {google.cloud.tpu.v2.ListNodesRequest} message ListNodesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -10347,7 +10377,7 @@ /** * Converts this ListNodesRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @instance * @returns {Object.} JSON object */ @@ -10358,7 +10388,7 @@ /** * Gets the default type url for ListNodesRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @memberof google.cloud.tpu.v2.ListNodesRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -10367,30 +10397,30 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListNodesRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListNodesRequest"; }; return ListNodesRequest; })(); - v2alpha1.ListNodesResponse = (function() { + v2.ListNodesResponse = (function() { /** * Properties of a ListNodesResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IListNodesResponse - * @property {Array.|null} [nodes] ListNodesResponse nodes + * @property {Array.|null} [nodes] ListNodesResponse nodes * @property {string|null} [nextPageToken] ListNodesResponse nextPageToken * @property {Array.|null} [unreachable] ListNodesResponse unreachable */ /** * Constructs a new ListNodesResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ListNodesResponse. * @implements IListNodesResponse * @constructor - * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListNodesResponse=} [properties] Properties to set */ function ListNodesResponse(properties) { this.nodes = []; @@ -10403,8 +10433,8 @@ /** * ListNodesResponse nodes. - * @member {Array.} nodes - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @member {Array.} nodes + * @memberof google.cloud.tpu.v2.ListNodesResponse * @instance */ ListNodesResponse.prototype.nodes = $util.emptyArray; @@ -10412,7 +10442,7 @@ /** * ListNodesResponse nextPageToken. * @member {string} nextPageToken - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @instance */ ListNodesResponse.prototype.nextPageToken = ""; @@ -10420,7 +10450,7 @@ /** * ListNodesResponse unreachable. * @member {Array.} unreachable - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @instance */ ListNodesResponse.prototype.unreachable = $util.emptyArray; @@ -10428,21 +10458,21 @@ /** * Creates a new ListNodesResponse instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse instance + * @param {google.cloud.tpu.v2.IListNodesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListNodesResponse} ListNodesResponse instance */ ListNodesResponse.create = function create(properties) { return new ListNodesResponse(properties); }; /** - * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListNodesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IListNodesResponse} message ListNodesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10451,7 +10481,7 @@ writer = $Writer.create(); if (message.nodes != null && message.nodes.length) for (var i = 0; i < message.nodes.length; ++i) - $root.google.cloud.tpu.v2alpha1.Node.encode(message.nodes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.tpu.v2.Node.encode(message.nodes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); if (message.unreachable != null && message.unreachable.length) @@ -10461,11 +10491,11 @@ }; /** - * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListNodesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IListNodesResponse} message ListNodesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10476,25 +10506,25 @@ /** * Decodes a ListNodesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @returns {google.cloud.tpu.v2.ListNodesResponse} ListNodesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ListNodesResponse.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.cloud.tpu.v2alpha1.ListNodesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListNodesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.nodes && message.nodes.length)) message.nodes = []; - message.nodes.push($root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32())); + message.nodes.push($root.google.cloud.tpu.v2.Node.decode(reader, reader.uint32())); break; } case 2: { @@ -10518,10 +10548,10 @@ /** * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @returns {google.cloud.tpu.v2.ListNodesResponse} ListNodesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -10534,7 +10564,7 @@ /** * Verifies a ListNodesResponse message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -10546,7 +10576,7 @@ if (!Array.isArray(message.nodes)) return "nodes: array expected"; for (var i = 0; i < message.nodes.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.nodes[i]); + var error = $root.google.cloud.tpu.v2.Node.verify(message.nodes[i]); if (error) return "nodes." + error; } @@ -10567,30 +10597,30 @@ /** * Creates a ListNodesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @returns {google.cloud.tpu.v2.ListNodesResponse} ListNodesResponse */ ListNodesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesResponse) + if (object instanceof $root.google.cloud.tpu.v2.ListNodesResponse) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListNodesResponse(); + var message = new $root.google.cloud.tpu.v2.ListNodesResponse(); if (object.nodes) { if (!Array.isArray(object.nodes)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: array expected"); + throw TypeError(".google.cloud.tpu.v2.ListNodesResponse.nodes: array expected"); message.nodes = []; for (var i = 0; i < object.nodes.length; ++i) { if (typeof object.nodes[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: object expected"); - message.nodes[i] = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.nodes[i]); + throw TypeError(".google.cloud.tpu.v2.ListNodesResponse.nodes: object expected"); + message.nodes[i] = $root.google.cloud.tpu.v2.Node.fromObject(object.nodes[i]); } } if (object.nextPageToken != null) message.nextPageToken = String(object.nextPageToken); if (object.unreachable) { if (!Array.isArray(object.unreachable)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.unreachable: array expected"); + throw TypeError(".google.cloud.tpu.v2.ListNodesResponse.unreachable: array expected"); message.unreachable = []; for (var i = 0; i < object.unreachable.length; ++i) message.unreachable[i] = String(object.unreachable[i]); @@ -10601,9 +10631,9 @@ /** * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static - * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} message ListNodesResponse + * @param {google.cloud.tpu.v2.ListNodesResponse} message ListNodesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -10620,7 +10650,7 @@ if (message.nodes && message.nodes.length) { object.nodes = []; for (var j = 0; j < message.nodes.length; ++j) - object.nodes[j] = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.nodes[j], options); + object.nodes[j] = $root.google.cloud.tpu.v2.Node.toObject(message.nodes[j], options); } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) object.nextPageToken = message.nextPageToken; @@ -10635,7 +10665,7 @@ /** * Converts this ListNodesResponse to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @instance * @returns {Object.} JSON object */ @@ -10646,7 +10676,7 @@ /** * Gets the default type url for ListNodesResponse * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @memberof google.cloud.tpu.v2.ListNodesResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -10655,28 +10685,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListNodesResponse"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListNodesResponse"; }; return ListNodesResponse; })(); - v2alpha1.GetNodeRequest = (function() { + v2.GetNodeRequest = (function() { /** * Properties of a GetNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGetNodeRequest * @property {string|null} [name] GetNodeRequest name */ /** * Constructs a new GetNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GetNodeRequest. * @implements IGetNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGetNodeRequest=} [properties] Properties to set */ function GetNodeRequest(properties) { if (properties) @@ -10688,7 +10718,7 @@ /** * GetNodeRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @instance */ GetNodeRequest.prototype.name = ""; @@ -10696,21 +10726,21 @@ /** * Creates a new GetNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest instance + * @param {google.cloud.tpu.v2.IGetNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GetNodeRequest} GetNodeRequest instance */ GetNodeRequest.create = function create(properties) { return new GetNodeRequest(properties); }; /** - * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGetNodeRequest} message GetNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10723,11 +10753,11 @@ }; /** - * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGetNodeRequest} message GetNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10738,18 +10768,18 @@ /** * Decodes a GetNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @returns {google.cloud.tpu.v2.GetNodeRequest} GetNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GetNodeRequest.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.cloud.tpu.v2alpha1.GetNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GetNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -10768,10 +10798,10 @@ /** * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @returns {google.cloud.tpu.v2.GetNodeRequest} GetNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -10784,7 +10814,7 @@ /** * Verifies a GetNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -10801,15 +10831,15 @@ /** * Creates a GetNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @returns {google.cloud.tpu.v2.GetNodeRequest} GetNodeRequest */ GetNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GetNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.GetNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GetNodeRequest(); + var message = new $root.google.cloud.tpu.v2.GetNodeRequest(); if (object.name != null) message.name = String(object.name); return message; @@ -10818,9 +10848,9 @@ /** * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.GetNodeRequest} message GetNodeRequest + * @param {google.cloud.tpu.v2.GetNodeRequest} message GetNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -10838,7 +10868,7 @@ /** * Converts this GetNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @instance * @returns {Object.} JSON object */ @@ -10849,7 +10879,7 @@ /** * Gets the default type url for GetNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @memberof google.cloud.tpu.v2.GetNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -10858,30 +10888,30 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GetNodeRequest"; }; return GetNodeRequest; })(); - v2alpha1.CreateNodeRequest = (function() { + v2.CreateNodeRequest = (function() { /** * Properties of a CreateNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface ICreateNodeRequest * @property {string|null} [parent] CreateNodeRequest parent * @property {string|null} [nodeId] CreateNodeRequest nodeId - * @property {google.cloud.tpu.v2alpha1.INode|null} [node] CreateNodeRequest node + * @property {google.cloud.tpu.v2.INode|null} [node] CreateNodeRequest node */ /** * Constructs a new CreateNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a CreateNodeRequest. * @implements ICreateNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.ICreateNodeRequest=} [properties] Properties to set */ function CreateNodeRequest(properties) { if (properties) @@ -10893,7 +10923,7 @@ /** * CreateNodeRequest parent. * @member {string} parent - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @instance */ CreateNodeRequest.prototype.parent = ""; @@ -10901,15 +10931,15 @@ /** * CreateNodeRequest nodeId. * @member {string} nodeId - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @instance */ CreateNodeRequest.prototype.nodeId = ""; /** * CreateNodeRequest node. - * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @member {google.cloud.tpu.v2.INode|null|undefined} node + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @instance */ CreateNodeRequest.prototype.node = null; @@ -10917,21 +10947,21 @@ /** * Creates a new CreateNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest instance + * @param {google.cloud.tpu.v2.ICreateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.CreateNodeRequest} CreateNodeRequest instance */ CreateNodeRequest.create = function create(properties) { return new CreateNodeRequest(properties); }; /** - * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.CreateNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10943,16 +10973,16 @@ if (message.nodeId != null && Object.hasOwnProperty.call(message, "nodeId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeId); if (message.node != null && Object.hasOwnProperty.call(message, "node")) - $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.cloud.tpu.v2.Node.encode(message.node, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.CreateNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -10963,18 +10993,18 @@ /** * Decodes a CreateNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @returns {google.cloud.tpu.v2.CreateNodeRequest} CreateNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CreateNodeRequest.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.cloud.tpu.v2alpha1.CreateNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.CreateNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -10987,7 +11017,7 @@ break; } case 3: { - message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + message.node = $root.google.cloud.tpu.v2.Node.decode(reader, reader.uint32()); break; } default: @@ -11001,10 +11031,10 @@ /** * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @returns {google.cloud.tpu.v2.CreateNodeRequest} CreateNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -11017,7 +11047,7 @@ /** * Verifies a CreateNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -11032,7 +11062,7 @@ if (!$util.isString(message.nodeId)) return "nodeId: string expected"; if (message.node != null && message.hasOwnProperty("node")) { - var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + var error = $root.google.cloud.tpu.v2.Node.verify(message.node); if (error) return "node." + error; } @@ -11042,23 +11072,23 @@ /** * Creates a CreateNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @returns {google.cloud.tpu.v2.CreateNodeRequest} CreateNodeRequest */ CreateNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.CreateNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.CreateNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.CreateNodeRequest(); + var message = new $root.google.cloud.tpu.v2.CreateNodeRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.nodeId != null) message.nodeId = String(object.nodeId); if (object.node != null) { if (typeof object.node !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.CreateNodeRequest.node: object expected"); - message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + throw TypeError(".google.cloud.tpu.v2.CreateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2.Node.fromObject(object.node); } return message; }; @@ -11066,9 +11096,9 @@ /** * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.CreateNodeRequest} message CreateNodeRequest + * @param {google.cloud.tpu.v2.CreateNodeRequest} message CreateNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -11086,14 +11116,14 @@ if (message.nodeId != null && message.hasOwnProperty("nodeId")) object.nodeId = message.nodeId; if (message.node != null && message.hasOwnProperty("node")) - object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + object.node = $root.google.cloud.tpu.v2.Node.toObject(message.node, options); return object; }; /** * Converts this CreateNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @instance * @returns {Object.} JSON object */ @@ -11104,7 +11134,7 @@ /** * Gets the default type url for CreateNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @memberof google.cloud.tpu.v2.CreateNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -11113,28 +11143,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.CreateNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.CreateNodeRequest"; }; return CreateNodeRequest; })(); - v2alpha1.DeleteNodeRequest = (function() { + v2.DeleteNodeRequest = (function() { /** * Properties of a DeleteNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IDeleteNodeRequest * @property {string|null} [name] DeleteNodeRequest name */ /** * Constructs a new DeleteNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a DeleteNodeRequest. * @implements IDeleteNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IDeleteNodeRequest=} [properties] Properties to set */ function DeleteNodeRequest(properties) { if (properties) @@ -11146,7 +11176,7 @@ /** * DeleteNodeRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @instance */ DeleteNodeRequest.prototype.name = ""; @@ -11154,21 +11184,21 @@ /** * Creates a new DeleteNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest instance + * @param {google.cloud.tpu.v2.IDeleteNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.DeleteNodeRequest} DeleteNodeRequest instance */ DeleteNodeRequest.create = function create(properties) { return new DeleteNodeRequest(properties); }; /** - * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.DeleteNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11181,11 +11211,11 @@ }; /** - * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.DeleteNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11196,18 +11226,18 @@ /** * Decodes a DeleteNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @returns {google.cloud.tpu.v2.DeleteNodeRequest} DeleteNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ DeleteNodeRequest.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.cloud.tpu.v2alpha1.DeleteNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.DeleteNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -11226,10 +11256,10 @@ /** * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @returns {google.cloud.tpu.v2.DeleteNodeRequest} DeleteNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -11242,7 +11272,7 @@ /** * Verifies a DeleteNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -11259,15 +11289,15 @@ /** * Creates a DeleteNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @returns {google.cloud.tpu.v2.DeleteNodeRequest} DeleteNodeRequest */ DeleteNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.DeleteNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest(); + var message = new $root.google.cloud.tpu.v2.DeleteNodeRequest(); if (object.name != null) message.name = String(object.name); return message; @@ -11276,9 +11306,9 @@ /** * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.DeleteNodeRequest} message DeleteNodeRequest + * @param {google.cloud.tpu.v2.DeleteNodeRequest} message DeleteNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -11296,7 +11326,7 @@ /** * Converts this DeleteNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @instance * @returns {Object.} JSON object */ @@ -11307,7 +11337,7 @@ /** * Gets the default type url for DeleteNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @memberof google.cloud.tpu.v2.DeleteNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -11316,28 +11346,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.DeleteNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.DeleteNodeRequest"; }; return DeleteNodeRequest; })(); - v2alpha1.StopNodeRequest = (function() { + v2.StopNodeRequest = (function() { /** * Properties of a StopNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IStopNodeRequest * @property {string|null} [name] StopNodeRequest name */ /** * Constructs a new StopNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a StopNodeRequest. * @implements IStopNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IStopNodeRequest=} [properties] Properties to set */ function StopNodeRequest(properties) { if (properties) @@ -11349,7 +11379,7 @@ /** * StopNodeRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @instance */ StopNodeRequest.prototype.name = ""; @@ -11357,21 +11387,21 @@ /** * Creates a new StopNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest instance + * @param {google.cloud.tpu.v2.IStopNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.StopNodeRequest} StopNodeRequest instance */ StopNodeRequest.create = function create(properties) { return new StopNodeRequest(properties); }; /** - * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.StopNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IStopNodeRequest} message StopNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11384,11 +11414,11 @@ }; /** - * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.StopNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IStopNodeRequest} message StopNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11399,18 +11429,18 @@ /** * Decodes a StopNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @returns {google.cloud.tpu.v2.StopNodeRequest} StopNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ StopNodeRequest.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.cloud.tpu.v2alpha1.StopNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.StopNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -11429,10 +11459,10 @@ /** * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @returns {google.cloud.tpu.v2.StopNodeRequest} StopNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -11445,7 +11475,7 @@ /** * Verifies a StopNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -11462,15 +11492,15 @@ /** * Creates a StopNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @returns {google.cloud.tpu.v2.StopNodeRequest} StopNodeRequest */ StopNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.StopNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.StopNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.StopNodeRequest(); + var message = new $root.google.cloud.tpu.v2.StopNodeRequest(); if (object.name != null) message.name = String(object.name); return message; @@ -11479,9 +11509,9 @@ /** * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.StopNodeRequest} message StopNodeRequest + * @param {google.cloud.tpu.v2.StopNodeRequest} message StopNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -11499,7 +11529,7 @@ /** * Converts this StopNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @instance * @returns {Object.} JSON object */ @@ -11510,7 +11540,7 @@ /** * Gets the default type url for StopNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @memberof google.cloud.tpu.v2.StopNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -11519,28 +11549,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.StopNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.StopNodeRequest"; }; return StopNodeRequest; })(); - v2alpha1.StartNodeRequest = (function() { + v2.StartNodeRequest = (function() { /** * Properties of a StartNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IStartNodeRequest * @property {string|null} [name] StartNodeRequest name */ /** * Constructs a new StartNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a StartNodeRequest. * @implements IStartNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IStartNodeRequest=} [properties] Properties to set */ function StartNodeRequest(properties) { if (properties) @@ -11552,7 +11582,7 @@ /** * StartNodeRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @instance */ StartNodeRequest.prototype.name = ""; @@ -11560,21 +11590,21 @@ /** * Creates a new StartNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest instance + * @param {google.cloud.tpu.v2.IStartNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.StartNodeRequest} StartNodeRequest instance */ StartNodeRequest.create = function create(properties) { return new StartNodeRequest(properties); }; /** - * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.StartNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IStartNodeRequest} message StartNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11587,11 +11617,11 @@ }; /** - * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.StartNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IStartNodeRequest} message StartNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11602,18 +11632,18 @@ /** * Decodes a StartNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @returns {google.cloud.tpu.v2.StartNodeRequest} StartNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ StartNodeRequest.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.cloud.tpu.v2alpha1.StartNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.StartNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -11632,10 +11662,10 @@ /** * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @returns {google.cloud.tpu.v2.StartNodeRequest} StartNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -11648,7 +11678,7 @@ /** * Verifies a StartNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -11665,15 +11695,15 @@ /** * Creates a StartNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @returns {google.cloud.tpu.v2.StartNodeRequest} StartNodeRequest */ StartNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.StartNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.StartNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.StartNodeRequest(); + var message = new $root.google.cloud.tpu.v2.StartNodeRequest(); if (object.name != null) message.name = String(object.name); return message; @@ -11682,9 +11712,9 @@ /** * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.StartNodeRequest} message StartNodeRequest + * @param {google.cloud.tpu.v2.StartNodeRequest} message StartNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -11702,7 +11732,7 @@ /** * Converts this StartNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @instance * @returns {Object.} JSON object */ @@ -11713,7 +11743,7 @@ /** * Gets the default type url for StartNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @memberof google.cloud.tpu.v2.StartNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -11722,29 +11752,29 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.StartNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.StartNodeRequest"; }; return StartNodeRequest; })(); - v2alpha1.UpdateNodeRequest = (function() { + v2.UpdateNodeRequest = (function() { /** * Properties of an UpdateNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IUpdateNodeRequest * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateNodeRequest updateMask - * @property {google.cloud.tpu.v2alpha1.INode|null} [node] UpdateNodeRequest node + * @property {google.cloud.tpu.v2.INode|null} [node] UpdateNodeRequest node */ /** * Constructs a new UpdateNodeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents an UpdateNodeRequest. * @implements IUpdateNodeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IUpdateNodeRequest=} [properties] Properties to set */ function UpdateNodeRequest(properties) { if (properties) @@ -11756,15 +11786,15 @@ /** * UpdateNodeRequest updateMask. * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @instance */ UpdateNodeRequest.prototype.updateMask = null; /** * UpdateNodeRequest node. - * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @member {google.cloud.tpu.v2.INode|null|undefined} node + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @instance */ UpdateNodeRequest.prototype.node = null; @@ -11772,21 +11802,21 @@ /** * Creates a new UpdateNodeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest instance + * @param {google.cloud.tpu.v2.IUpdateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.UpdateNodeRequest} UpdateNodeRequest instance */ UpdateNodeRequest.create = function create(properties) { return new UpdateNodeRequest(properties); }; /** - * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2.UpdateNodeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11796,16 +11826,16 @@ if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.node != null && Object.hasOwnProperty.call(message, "node")) - $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.cloud.tpu.v2.Node.encode(message.node, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.UpdateNodeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -11816,18 +11846,18 @@ /** * Decodes an UpdateNodeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @returns {google.cloud.tpu.v2.UpdateNodeRequest} UpdateNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ UpdateNodeRequest.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.cloud.tpu.v2alpha1.UpdateNodeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.UpdateNodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -11836,7 +11866,7 @@ break; } case 2: { - message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + message.node = $root.google.cloud.tpu.v2.Node.decode(reader, reader.uint32()); break; } default: @@ -11850,10 +11880,10 @@ /** * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @returns {google.cloud.tpu.v2.UpdateNodeRequest} UpdateNodeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -11866,7 +11896,7 @@ /** * Verifies an UpdateNodeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -11880,7 +11910,7 @@ return "updateMask." + error; } if (message.node != null && message.hasOwnProperty("node")) { - var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + var error = $root.google.cloud.tpu.v2.Node.verify(message.node); if (error) return "node." + error; } @@ -11890,24 +11920,24 @@ /** * Creates an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @returns {google.cloud.tpu.v2.UpdateNodeRequest} UpdateNodeRequest */ UpdateNodeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest) + if (object instanceof $root.google.cloud.tpu.v2.UpdateNodeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest(); + var message = new $root.google.cloud.tpu.v2.UpdateNodeRequest(); if (object.updateMask != null) { if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.updateMask: object expected"); + throw TypeError(".google.cloud.tpu.v2.UpdateNodeRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } if (object.node != null) { if (typeof object.node !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.node: object expected"); - message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + throw TypeError(".google.cloud.tpu.v2.UpdateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2.Node.fromObject(object.node); } return message; }; @@ -11915,9 +11945,9 @@ /** * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static - * @param {google.cloud.tpu.v2alpha1.UpdateNodeRequest} message UpdateNodeRequest + * @param {google.cloud.tpu.v2.UpdateNodeRequest} message UpdateNodeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -11932,14 +11962,14 @@ if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); if (message.node != null && message.hasOwnProperty("node")) - object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + object.node = $root.google.cloud.tpu.v2.Node.toObject(message.node, options); return object; }; /** * Converts this UpdateNodeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @instance * @returns {Object.} JSON object */ @@ -11950,7 +11980,7 @@ /** * Gets the default type url for UpdateNodeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @memberof google.cloud.tpu.v2.UpdateNodeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -11959,28 +11989,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.UpdateNodeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.UpdateNodeRequest"; }; return UpdateNodeRequest; })(); - v2alpha1.ServiceIdentity = (function() { + v2.ServiceIdentity = (function() { /** * Properties of a ServiceIdentity. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IServiceIdentity * @property {string|null} [email] ServiceIdentity email */ /** * Constructs a new ServiceIdentity. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ServiceIdentity. * @implements IServiceIdentity * @constructor - * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IServiceIdentity=} [properties] Properties to set */ function ServiceIdentity(properties) { if (properties) @@ -11992,7 +12022,7 @@ /** * ServiceIdentity email. * @member {string} email - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @instance */ ServiceIdentity.prototype.email = ""; @@ -12000,21 +12030,21 @@ /** * Creates a new ServiceIdentity instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static - * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity instance + * @param {google.cloud.tpu.v2.IServiceIdentity=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ServiceIdentity} ServiceIdentity instance */ ServiceIdentity.create = function create(properties) { return new ServiceIdentity(properties); }; /** - * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2.ServiceIdentity.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static - * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {google.cloud.tpu.v2.IServiceIdentity} message ServiceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12027,11 +12057,11 @@ }; /** - * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ServiceIdentity.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static - * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {google.cloud.tpu.v2.IServiceIdentity} message ServiceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12042,18 +12072,18 @@ /** * Decodes a ServiceIdentity message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @returns {google.cloud.tpu.v2.ServiceIdentity} ServiceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ServiceIdentity.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.cloud.tpu.v2alpha1.ServiceIdentity(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ServiceIdentity(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12072,10 +12102,10 @@ /** * Decodes a ServiceIdentity message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @returns {google.cloud.tpu.v2.ServiceIdentity} ServiceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -12088,7 +12118,7 @@ /** * Verifies a ServiceIdentity message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -12105,15 +12135,15 @@ /** * Creates a ServiceIdentity message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @returns {google.cloud.tpu.v2.ServiceIdentity} ServiceIdentity */ ServiceIdentity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceIdentity) + if (object instanceof $root.google.cloud.tpu.v2.ServiceIdentity) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ServiceIdentity(); + var message = new $root.google.cloud.tpu.v2.ServiceIdentity(); if (object.email != null) message.email = String(object.email); return message; @@ -12122,9 +12152,9 @@ /** * Creates a plain object from a ServiceIdentity message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static - * @param {google.cloud.tpu.v2alpha1.ServiceIdentity} message ServiceIdentity + * @param {google.cloud.tpu.v2.ServiceIdentity} message ServiceIdentity * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -12142,7 +12172,7 @@ /** * Converts this ServiceIdentity to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @instance * @returns {Object.} JSON object */ @@ -12153,7 +12183,7 @@ /** * Gets the default type url for ServiceIdentity * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @memberof google.cloud.tpu.v2.ServiceIdentity * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -12162,28 +12192,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ServiceIdentity"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ServiceIdentity"; }; return ServiceIdentity; })(); - v2alpha1.GenerateServiceIdentityRequest = (function() { + v2.GenerateServiceIdentityRequest = (function() { /** * Properties of a GenerateServiceIdentityRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGenerateServiceIdentityRequest * @property {string|null} [parent] GenerateServiceIdentityRequest parent */ /** * Constructs a new GenerateServiceIdentityRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GenerateServiceIdentityRequest. * @implements IGenerateServiceIdentityRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest=} [properties] Properties to set */ function GenerateServiceIdentityRequest(properties) { if (properties) @@ -12195,7 +12225,7 @@ /** * GenerateServiceIdentityRequest parent. * @member {string} parent - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @instance */ GenerateServiceIdentityRequest.prototype.parent = ""; @@ -12203,21 +12233,21 @@ /** * Creates a new GenerateServiceIdentityRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest instance + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest instance */ GenerateServiceIdentityRequest.create = function create(properties) { return new GenerateServiceIdentityRequest(properties); }; /** - * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12230,11 +12260,11 @@ }; /** - * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12245,18 +12275,18 @@ /** * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GenerateServiceIdentityRequest.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.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GenerateServiceIdentityRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12275,10 +12305,10 @@ /** * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -12291,7 +12321,7 @@ /** * Verifies a GenerateServiceIdentityRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -12308,15 +12338,15 @@ /** * Creates a GenerateServiceIdentityRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest */ GenerateServiceIdentityRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest) + if (object instanceof $root.google.cloud.tpu.v2.GenerateServiceIdentityRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + var message = new $root.google.cloud.tpu.v2.GenerateServiceIdentityRequest(); if (object.parent != null) message.parent = String(object.parent); return message; @@ -12325,9 +12355,9 @@ /** * Creates a plain object from a GenerateServiceIdentityRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static - * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} message GenerateServiceIdentityRequest + * @param {google.cloud.tpu.v2.GenerateServiceIdentityRequest} message GenerateServiceIdentityRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -12345,7 +12375,7 @@ /** * Converts this GenerateServiceIdentityRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @instance * @returns {Object.} JSON object */ @@ -12356,7 +12386,7 @@ /** * Gets the default type url for GenerateServiceIdentityRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -12365,28 +12395,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GenerateServiceIdentityRequest"; }; return GenerateServiceIdentityRequest; })(); - v2alpha1.GenerateServiceIdentityResponse = (function() { + v2.GenerateServiceIdentityResponse = (function() { /** * Properties of a GenerateServiceIdentityResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGenerateServiceIdentityResponse - * @property {google.cloud.tpu.v2alpha1.IServiceIdentity|null} [identity] GenerateServiceIdentityResponse identity + * @property {google.cloud.tpu.v2.IServiceIdentity|null} [identity] GenerateServiceIdentityResponse identity */ /** * Constructs a new GenerateServiceIdentityResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GenerateServiceIdentityResponse. * @implements IGenerateServiceIdentityResponse * @constructor - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityResponse=} [properties] Properties to set */ function GenerateServiceIdentityResponse(properties) { if (properties) @@ -12397,8 +12427,8 @@ /** * GenerateServiceIdentityResponse identity. - * @member {google.cloud.tpu.v2alpha1.IServiceIdentity|null|undefined} identity - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @member {google.cloud.tpu.v2.IServiceIdentity|null|undefined} identity + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @instance */ GenerateServiceIdentityResponse.prototype.identity = null; @@ -12406,21 +12436,21 @@ /** * Creates a new GenerateServiceIdentityResponse instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse instance + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse instance */ GenerateServiceIdentityResponse.create = function create(properties) { return new GenerateServiceIdentityResponse(properties); }; /** - * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12428,16 +12458,16 @@ if (!writer) writer = $Writer.create(); if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - $root.google.cloud.tpu.v2alpha1.ServiceIdentity.encode(message.identity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.tpu.v2.ServiceIdentity.encode(message.identity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GenerateServiceIdentityResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static - * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12448,23 +12478,23 @@ /** * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GenerateServiceIdentityResponse.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.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GenerateServiceIdentityResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.decode(reader, reader.uint32()); + message.identity = $root.google.cloud.tpu.v2.ServiceIdentity.decode(reader, reader.uint32()); break; } default: @@ -12478,10 +12508,10 @@ /** * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -12494,7 +12524,7 @@ /** * Verifies a GenerateServiceIdentityResponse message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -12503,7 +12533,7 @@ if (typeof message !== "object" || message === null) return "object expected"; if (message.identity != null && message.hasOwnProperty("identity")) { - var error = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.verify(message.identity); + var error = $root.google.cloud.tpu.v2.ServiceIdentity.verify(message.identity); if (error) return "identity." + error; } @@ -12513,19 +12543,19 @@ /** * Creates a GenerateServiceIdentityResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @returns {google.cloud.tpu.v2.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse */ GenerateServiceIdentityResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) + if (object instanceof $root.google.cloud.tpu.v2.GenerateServiceIdentityResponse) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + var message = new $root.google.cloud.tpu.v2.GenerateServiceIdentityResponse(); if (object.identity != null) { if (typeof object.identity !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.identity: object expected"); - message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.fromObject(object.identity); + throw TypeError(".google.cloud.tpu.v2.GenerateServiceIdentityResponse.identity: object expected"); + message.identity = $root.google.cloud.tpu.v2.ServiceIdentity.fromObject(object.identity); } return message; }; @@ -12533,9 +12563,9 @@ /** * Creates a plain object from a GenerateServiceIdentityResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static - * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} message GenerateServiceIdentityResponse + * @param {google.cloud.tpu.v2.GenerateServiceIdentityResponse} message GenerateServiceIdentityResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -12546,14 +12576,14 @@ if (options.defaults) object.identity = null; if (message.identity != null && message.hasOwnProperty("identity")) - object.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.toObject(message.identity, options); + object.identity = $root.google.cloud.tpu.v2.ServiceIdentity.toObject(message.identity, options); return object; }; /** * Converts this GenerateServiceIdentityResponse to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @instance * @returns {Object.} JSON object */ @@ -12564,7 +12594,7 @@ /** * Gets the default type url for GenerateServiceIdentityResponse * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @memberof google.cloud.tpu.v2.GenerateServiceIdentityResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -12573,17 +12603,17 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GenerateServiceIdentityResponse"; }; return GenerateServiceIdentityResponse; })(); - v2alpha1.AcceleratorType = (function() { + v2.AcceleratorType = (function() { /** * Properties of an AcceleratorType. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IAcceleratorType * @property {string|null} [name] AcceleratorType name * @property {string|null} [type] AcceleratorType type @@ -12591,11 +12621,11 @@ /** * Constructs a new AcceleratorType. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents an AcceleratorType. * @implements IAcceleratorType * @constructor - * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IAcceleratorType=} [properties] Properties to set */ function AcceleratorType(properties) { if (properties) @@ -12607,7 +12637,7 @@ /** * AcceleratorType name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @instance */ AcceleratorType.prototype.name = ""; @@ -12615,7 +12645,7 @@ /** * AcceleratorType type. * @member {string} type - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @instance */ AcceleratorType.prototype.type = ""; @@ -12623,21 +12653,21 @@ /** * Creates a new AcceleratorType instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static - * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType instance + * @param {google.cloud.tpu.v2.IAcceleratorType=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.AcceleratorType} AcceleratorType instance */ AcceleratorType.create = function create(properties) { return new AcceleratorType(properties); }; /** - * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2.AcceleratorType.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static - * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {google.cloud.tpu.v2.IAcceleratorType} message AcceleratorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12652,11 +12682,11 @@ }; /** - * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.AcceleratorType.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static - * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {google.cloud.tpu.v2.IAcceleratorType} message AcceleratorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12667,18 +12697,18 @@ /** * Decodes an AcceleratorType message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @returns {google.cloud.tpu.v2.AcceleratorType} AcceleratorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ AcceleratorType.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.cloud.tpu.v2alpha1.AcceleratorType(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.AcceleratorType(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12701,10 +12731,10 @@ /** * Decodes an AcceleratorType message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @returns {google.cloud.tpu.v2.AcceleratorType} AcceleratorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -12717,7 +12747,7 @@ /** * Verifies an AcceleratorType message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -12737,15 +12767,15 @@ /** * Creates an AcceleratorType message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @returns {google.cloud.tpu.v2.AcceleratorType} AcceleratorType */ AcceleratorType.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.AcceleratorType) + if (object instanceof $root.google.cloud.tpu.v2.AcceleratorType) return object; - var message = new $root.google.cloud.tpu.v2alpha1.AcceleratorType(); + var message = new $root.google.cloud.tpu.v2.AcceleratorType(); if (object.name != null) message.name = String(object.name); if (object.type != null) @@ -12756,9 +12786,9 @@ /** * Creates a plain object from an AcceleratorType message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static - * @param {google.cloud.tpu.v2alpha1.AcceleratorType} message AcceleratorType + * @param {google.cloud.tpu.v2.AcceleratorType} message AcceleratorType * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -12780,7 +12810,7 @@ /** * Converts this AcceleratorType to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @instance * @returns {Object.} JSON object */ @@ -12791,7 +12821,7 @@ /** * Gets the default type url for AcceleratorType * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @memberof google.cloud.tpu.v2.AcceleratorType * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -12800,28 +12830,28 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AcceleratorType"; + return typeUrlPrefix + "/google.cloud.tpu.v2.AcceleratorType"; }; return AcceleratorType; })(); - v2alpha1.GetAcceleratorTypeRequest = (function() { + v2.GetAcceleratorTypeRequest = (function() { /** * Properties of a GetAcceleratorTypeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IGetAcceleratorTypeRequest * @property {string|null} [name] GetAcceleratorTypeRequest name */ /** * Constructs a new GetAcceleratorTypeRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a GetAcceleratorTypeRequest. * @implements IGetAcceleratorTypeRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest=} [properties] Properties to set */ function GetAcceleratorTypeRequest(properties) { if (properties) @@ -12833,7 +12863,7 @@ /** * GetAcceleratorTypeRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @instance */ GetAcceleratorTypeRequest.prototype.name = ""; @@ -12841,21 +12871,21 @@ /** * Creates a new GetAcceleratorTypeRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest instance + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest instance */ GetAcceleratorTypeRequest.create = function create(properties) { return new GetAcceleratorTypeRequest(properties); }; /** - * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetAcceleratorTypeRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12868,11 +12898,11 @@ }; /** - * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetAcceleratorTypeRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -12883,18 +12913,18 @@ /** * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @returns {google.cloud.tpu.v2.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GetAcceleratorTypeRequest.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.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GetAcceleratorTypeRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -12913,10 +12943,10 @@ /** * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @returns {google.cloud.tpu.v2.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -12929,7 +12959,7 @@ /** * Verifies a GetAcceleratorTypeRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -12946,15 +12976,15 @@ /** * Creates a GetAcceleratorTypeRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @returns {google.cloud.tpu.v2.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest */ GetAcceleratorTypeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest) + if (object instanceof $root.google.cloud.tpu.v2.GetAcceleratorTypeRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + var message = new $root.google.cloud.tpu.v2.GetAcceleratorTypeRequest(); if (object.name != null) message.name = String(object.name); return message; @@ -12963,9 +12993,9 @@ /** * Creates a plain object from a GetAcceleratorTypeRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static - * @param {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} message GetAcceleratorTypeRequest + * @param {google.cloud.tpu.v2.GetAcceleratorTypeRequest} message GetAcceleratorTypeRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -12983,7 +13013,7 @@ /** * Converts this GetAcceleratorTypeRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @instance * @returns {Object.} JSON object */ @@ -12994,7 +13024,7 @@ /** * Gets the default type url for GetAcceleratorTypeRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @memberof google.cloud.tpu.v2.GetAcceleratorTypeRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -13003,17 +13033,17 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GetAcceleratorTypeRequest"; }; return GetAcceleratorTypeRequest; })(); - v2alpha1.ListAcceleratorTypesRequest = (function() { + v2.ListAcceleratorTypesRequest = (function() { /** * Properties of a ListAcceleratorTypesRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IListAcceleratorTypesRequest * @property {string|null} [parent] ListAcceleratorTypesRequest parent * @property {number|null} [pageSize] ListAcceleratorTypesRequest pageSize @@ -13024,11 +13054,11 @@ /** * Constructs a new ListAcceleratorTypesRequest. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ListAcceleratorTypesRequest. * @implements IListAcceleratorTypesRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest=} [properties] Properties to set */ function ListAcceleratorTypesRequest(properties) { if (properties) @@ -13040,7 +13070,7 @@ /** * ListAcceleratorTypesRequest parent. * @member {string} parent - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance */ ListAcceleratorTypesRequest.prototype.parent = ""; @@ -13048,7 +13078,7 @@ /** * ListAcceleratorTypesRequest pageSize. * @member {number} pageSize - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance */ ListAcceleratorTypesRequest.prototype.pageSize = 0; @@ -13056,7 +13086,7 @@ /** * ListAcceleratorTypesRequest pageToken. * @member {string} pageToken - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance */ ListAcceleratorTypesRequest.prototype.pageToken = ""; @@ -13064,7 +13094,7 @@ /** * ListAcceleratorTypesRequest filter. * @member {string} filter - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance */ ListAcceleratorTypesRequest.prototype.filter = ""; @@ -13072,7 +13102,7 @@ /** * ListAcceleratorTypesRequest orderBy. * @member {string} orderBy - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance */ ListAcceleratorTypesRequest.prototype.orderBy = ""; @@ -13080,21 +13110,21 @@ /** * Creates a new ListAcceleratorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest instance + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest instance */ ListAcceleratorTypesRequest.create = function create(properties) { return new ListAcceleratorTypesRequest(properties); }; /** - * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -13115,11 +13145,11 @@ }; /** - * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -13130,18 +13160,18 @@ /** * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ListAcceleratorTypesRequest.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.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListAcceleratorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -13176,10 +13206,10 @@ /** * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -13192,7 +13222,7 @@ /** * Verifies a ListAcceleratorTypesRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -13221,15 +13251,15 @@ /** * Creates a ListAcceleratorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest */ ListAcceleratorTypesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest) + if (object instanceof $root.google.cloud.tpu.v2.ListAcceleratorTypesRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + var message = new $root.google.cloud.tpu.v2.ListAcceleratorTypesRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.pageSize != null) @@ -13246,9 +13276,9 @@ /** * Creates a plain object from a ListAcceleratorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static - * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} message ListAcceleratorTypesRequest + * @param {google.cloud.tpu.v2.ListAcceleratorTypesRequest} message ListAcceleratorTypesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -13279,7 +13309,7 @@ /** * Converts this ListAcceleratorTypesRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @instance * @returns {Object.} JSON object */ @@ -13290,7 +13320,7 @@ /** * Gets the default type url for ListAcceleratorTypesRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -13299,30 +13329,30 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListAcceleratorTypesRequest"; }; return ListAcceleratorTypesRequest; })(); - v2alpha1.ListAcceleratorTypesResponse = (function() { + v2.ListAcceleratorTypesResponse = (function() { /** * Properties of a ListAcceleratorTypesResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @interface IListAcceleratorTypesResponse - * @property {Array.|null} [acceleratorTypes] ListAcceleratorTypesResponse acceleratorTypes + * @property {Array.|null} [acceleratorTypes] ListAcceleratorTypesResponse acceleratorTypes * @property {string|null} [nextPageToken] ListAcceleratorTypesResponse nextPageToken * @property {Array.|null} [unreachable] ListAcceleratorTypesResponse unreachable */ /** * Constructs a new ListAcceleratorTypesResponse. - * @memberof google.cloud.tpu.v2alpha1 + * @memberof google.cloud.tpu.v2 * @classdesc Represents a ListAcceleratorTypesResponse. * @implements IListAcceleratorTypesResponse * @constructor - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListAcceleratorTypesResponse=} [properties] Properties to set */ function ListAcceleratorTypesResponse(properties) { this.acceleratorTypes = []; @@ -13335,8 +13365,8 @@ /** * ListAcceleratorTypesResponse acceleratorTypes. - * @member {Array.} acceleratorTypes - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @member {Array.} acceleratorTypes + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @instance */ ListAcceleratorTypesResponse.prototype.acceleratorTypes = $util.emptyArray; @@ -13344,7 +13374,7 @@ /** * ListAcceleratorTypesResponse nextPageToken. * @member {string} nextPageToken - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @instance */ ListAcceleratorTypesResponse.prototype.nextPageToken = ""; @@ -13352,7 +13382,7 @@ /** * ListAcceleratorTypesResponse unreachable. * @member {Array.} unreachable - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @instance */ ListAcceleratorTypesResponse.prototype.unreachable = $util.emptyArray; @@ -13360,21 +13390,21 @@ /** * Creates a new ListAcceleratorTypesResponse instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse instance + * @param {google.cloud.tpu.v2.IListAcceleratorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse instance */ ListAcceleratorTypesResponse.create = function create(properties) { return new ListAcceleratorTypesResponse(properties); }; /** - * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -13383,7 +13413,7 @@ writer = $Writer.create(); if (message.acceleratorTypes != null && message.acceleratorTypes.length) for (var i = 0; i < message.acceleratorTypes.length; ++i) - $root.google.cloud.tpu.v2alpha1.AcceleratorType.encode(message.acceleratorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.tpu.v2.AcceleratorType.encode(message.acceleratorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); if (message.unreachable != null && message.unreachable.length) @@ -13393,11 +13423,11 @@ }; /** - * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListAcceleratorTypesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -13408,25 +13438,25 @@ /** * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ListAcceleratorTypesResponse.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.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListAcceleratorTypesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.acceleratorTypes && message.acceleratorTypes.length)) message.acceleratorTypes = []; - message.acceleratorTypes.push($root.google.cloud.tpu.v2alpha1.AcceleratorType.decode(reader, reader.uint32())); + message.acceleratorTypes.push($root.google.cloud.tpu.v2.AcceleratorType.decode(reader, reader.uint32())); break; } case 2: { @@ -13450,10 +13480,10 @@ /** * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -13466,7 +13496,7 @@ /** * Verifies a ListAcceleratorTypesResponse message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -13478,7 +13508,7 @@ if (!Array.isArray(message.acceleratorTypes)) return "acceleratorTypes: array expected"; for (var i = 0; i < message.acceleratorTypes.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.AcceleratorType.verify(message.acceleratorTypes[i]); + var error = $root.google.cloud.tpu.v2.AcceleratorType.verify(message.acceleratorTypes[i]); if (error) return "acceleratorTypes." + error; } @@ -13499,30 +13529,30 @@ /** * Creates a ListAcceleratorTypesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @returns {google.cloud.tpu.v2.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse */ ListAcceleratorTypesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) + if (object instanceof $root.google.cloud.tpu.v2.ListAcceleratorTypesResponse) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + var message = new $root.google.cloud.tpu.v2.ListAcceleratorTypesResponse(); if (object.acceleratorTypes) { if (!Array.isArray(object.acceleratorTypes)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: array expected"); + throw TypeError(".google.cloud.tpu.v2.ListAcceleratorTypesResponse.acceleratorTypes: array expected"); message.acceleratorTypes = []; for (var i = 0; i < object.acceleratorTypes.length; ++i) { if (typeof object.acceleratorTypes[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: object expected"); - message.acceleratorTypes[i] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.fromObject(object.acceleratorTypes[i]); + throw TypeError(".google.cloud.tpu.v2.ListAcceleratorTypesResponse.acceleratorTypes: object expected"); + message.acceleratorTypes[i] = $root.google.cloud.tpu.v2.AcceleratorType.fromObject(object.acceleratorTypes[i]); } } if (object.nextPageToken != null) message.nextPageToken = String(object.nextPageToken); if (object.unreachable) { if (!Array.isArray(object.unreachable)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.unreachable: array expected"); + throw TypeError(".google.cloud.tpu.v2.ListAcceleratorTypesResponse.unreachable: array expected"); message.unreachable = []; for (var i = 0; i < object.unreachable.length; ++i) message.unreachable[i] = String(object.unreachable[i]); @@ -13533,9 +13563,9 @@ /** * Creates a plain object from a ListAcceleratorTypesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static - * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} message ListAcceleratorTypesResponse + * @param {google.cloud.tpu.v2.ListAcceleratorTypesResponse} message ListAcceleratorTypesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -13552,7 +13582,7 @@ if (message.acceleratorTypes && message.acceleratorTypes.length) { object.acceleratorTypes = []; for (var j = 0; j < message.acceleratorTypes.length; ++j) - object.acceleratorTypes[j] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.toObject(message.acceleratorTypes[j], options); + object.acceleratorTypes[j] = $root.google.cloud.tpu.v2.AcceleratorType.toObject(message.acceleratorTypes[j], options); } if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) object.nextPageToken = message.nextPageToken; @@ -13567,7 +13597,7 @@ /** * Converts this ListAcceleratorTypesResponse to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @instance * @returns {Object.} JSON object */ @@ -13578,7 +13608,7 @@ /** * Gets the default type url for ListAcceleratorTypesResponse * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @memberof google.cloud.tpu.v2.ListAcceleratorTypesResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url @@ -13587,36 +13617,31 @@ if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListAcceleratorTypesResponse"; }; return ListAcceleratorTypesResponse; })(); - v2alpha1.OperationMetadata = (function() { + v2.RuntimeVersion = (function() { /** - * Properties of an OperationMetadata. - * @memberof google.cloud.tpu.v2alpha1 - * @interface IOperationMetadata - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime - * @property {string|null} [target] OperationMetadata target - * @property {string|null} [verb] OperationMetadata verb - * @property {string|null} [statusDetail] OperationMetadata statusDetail - * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested - * @property {string|null} [apiVersion] OperationMetadata apiVersion + * Properties of a RuntimeVersion. + * @memberof google.cloud.tpu.v2 + * @interface IRuntimeVersion + * @property {string|null} [name] RuntimeVersion name + * @property {string|null} [version] RuntimeVersion version */ /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * Constructs a new RuntimeVersion. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a RuntimeVersion. + * @implements IRuntimeVersion * @constructor - * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IRuntimeVersion=} [properties] Properties to set */ - function OperationMetadata(properties) { + function RuntimeVersion(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13624,159 +13649,89 @@ } /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.endTime = null; - - /** - * OperationMetadata target. - * @member {string} target - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.target = ""; - - /** - * OperationMetadata verb. - * @member {string} verb - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.verb = ""; - - /** - * OperationMetadata statusDetail. - * @member {string} statusDetail - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.statusDetail = ""; - - /** - * OperationMetadata cancelRequested. - * @member {boolean} cancelRequested - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * RuntimeVersion name. + * @member {string} name + * @memberof google.cloud.tpu.v2.RuntimeVersion * @instance */ - OperationMetadata.prototype.cancelRequested = false; + RuntimeVersion.prototype.name = ""; /** - * OperationMetadata apiVersion. - * @member {string} apiVersion - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * RuntimeVersion version. + * @member {string} version + * @memberof google.cloud.tpu.v2.RuntimeVersion * @instance */ - OperationMetadata.prototype.apiVersion = ""; + RuntimeVersion.prototype.version = ""; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new RuntimeVersion instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static - * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.tpu.v2.IRuntimeVersion=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.RuntimeVersion} RuntimeVersion instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + RuntimeVersion.create = function create(properties) { + return new RuntimeVersion(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2.RuntimeVersion.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static - * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.tpu.v2.IRuntimeVersion} message RuntimeVersion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + RuntimeVersion.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.target != null && Object.hasOwnProperty.call(message, "target")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); - if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); - if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); - if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); - if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.RuntimeVersion.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static - * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.tpu.v2.IRuntimeVersion} message RuntimeVersion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + RuntimeVersion.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes a RuntimeVersion message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @returns {google.cloud.tpu.v2.RuntimeVersion} RuntimeVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + RuntimeVersion.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.cloud.tpu.v2alpha1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.RuntimeVersion(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.name = reader.string(); break; } case 2: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.target = reader.string(); - break; - } - case 4: { - message.verb = reader.string(); - break; - } - case 5: { - message.statusDetail = reader.string(); - break; - } - case 6: { - message.cancelRequested = reader.bool(); - break; - } - case 7: { - message.apiVersion = reader.string(); + message.version = reader.string(); break; } default: @@ -13788,182 +13743,131 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @returns {google.cloud.tpu.v2.RuntimeVersion} RuntimeVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + RuntimeVersion.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies a RuntimeVersion message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + RuntimeVersion.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.target != null && message.hasOwnProperty("target")) - if (!$util.isString(message.target)) - return "target: string expected"; - if (message.verb != null && message.hasOwnProperty("verb")) - if (!$util.isString(message.verb)) - return "verb: string expected"; - if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) - if (!$util.isString(message.statusDetail)) - return "statusDetail: string expected"; - if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) - if (typeof message.cancelRequested !== "boolean") - return "cancelRequested: boolean expected"; - if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) - if (!$util.isString(message.apiVersion)) - return "apiVersion: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; return null; }; /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a RuntimeVersion message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @returns {google.cloud.tpu.v2.RuntimeVersion} RuntimeVersion */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.OperationMetadata) + RuntimeVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.RuntimeVersion) return object; - var message = new $root.google.cloud.tpu.v2alpha1.OperationMetadata(); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.target != null) - message.target = String(object.target); - if (object.verb != null) - message.verb = String(object.verb); - if (object.statusDetail != null) - message.statusDetail = String(object.statusDetail); - if (object.cancelRequested != null) - message.cancelRequested = Boolean(object.cancelRequested); - if (object.apiVersion != null) - message.apiVersion = String(object.apiVersion); + var message = new $root.google.cloud.tpu.v2.RuntimeVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.version != null) + message.version = String(object.version); return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static - * @param {google.cloud.tpu.v2alpha1.OperationMetadata} message OperationMetadata + * @param {google.cloud.tpu.v2.RuntimeVersion} message RuntimeVersion * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + RuntimeVersion.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.createTime = null; - object.endTime = null; - object.target = ""; - object.verb = ""; - object.statusDetail = ""; - object.cancelRequested = false; - object.apiVersion = ""; + object.name = ""; + object.version = ""; } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.target != null && message.hasOwnProperty("target")) - object.target = message.target; - if (message.verb != null && message.hasOwnProperty("verb")) - object.verb = message.verb; - if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) - object.statusDetail = message.statusDetail; - if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) - object.cancelRequested = message.cancelRequested; - if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) - object.apiVersion = message.apiVersion; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; return object; }; /** - * Converts this OperationMetadata to JSON. + * Converts this RuntimeVersion to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + RuntimeVersion.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for OperationMetadata + * Gets the default type url for RuntimeVersion * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @memberof google.cloud.tpu.v2.RuntimeVersion * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + RuntimeVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.OperationMetadata"; + return typeUrlPrefix + "/google.cloud.tpu.v2.RuntimeVersion"; }; - return OperationMetadata; + return RuntimeVersion; })(); - v2alpha1.RuntimeVersion = (function() { + v2.GetRuntimeVersionRequest = (function() { /** - * Properties of a RuntimeVersion. - * @memberof google.cloud.tpu.v2alpha1 - * @interface IRuntimeVersion - * @property {string|null} [name] RuntimeVersion name - * @property {string|null} [version] RuntimeVersion version + * Properties of a GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2 + * @interface IGetRuntimeVersionRequest + * @property {string|null} [name] GetRuntimeVersionRequest name */ /** - * Constructs a new RuntimeVersion. - * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents a RuntimeVersion. - * @implements IRuntimeVersion + * Constructs a new GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a GetRuntimeVersionRequest. + * @implements IGetRuntimeVersionRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest=} [properties] Properties to set */ - function RuntimeVersion(properties) { + function GetRuntimeVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13971,80 +13875,70 @@ } /** - * RuntimeVersion name. + * GetRuntimeVersionRequest name. * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @instance */ - RuntimeVersion.prototype.name = ""; - - /** - * RuntimeVersion version. - * @member {string} version - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion - * @instance - */ - RuntimeVersion.prototype.version = ""; + GetRuntimeVersionRequest.prototype.name = ""; /** - * Creates a new RuntimeVersion instance using the specified properties. + * Creates a new GetRuntimeVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static - * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion instance + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GetRuntimeVersionRequest} GetRuntimeVersionRequest instance */ - RuntimeVersion.create = function create(properties) { - return new RuntimeVersion(properties); + GetRuntimeVersionRequest.create = function create(properties) { + return new GetRuntimeVersionRequest(properties); }; /** - * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetRuntimeVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static - * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RuntimeVersion.encode = function encode(message, writer) { + GetRuntimeVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); return writer; }; /** - * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetRuntimeVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static - * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {google.cloud.tpu.v2.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RuntimeVersion.encodeDelimited = function encodeDelimited(message, writer) { + GetRuntimeVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a RuntimeVersion message from the specified reader or buffer. + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @returns {google.cloud.tpu.v2.GetRuntimeVersionRequest} GetRuntimeVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RuntimeVersion.decode = function decode(reader, length) { + GetRuntimeVersionRequest.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.cloud.tpu.v2alpha1.RuntimeVersion(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.GetRuntimeVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -14052,10 +13946,6 @@ message.name = reader.string(); break; } - case 2: { - message.version = reader.string(); - break; - } default: reader.skipType(tag & 7); break; @@ -14065,131 +13955,126 @@ }; /** - * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @returns {google.cloud.tpu.v2.GetRuntimeVersionRequest} GetRuntimeVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RuntimeVersion.decodeDelimited = function decodeDelimited(reader) { + GetRuntimeVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a RuntimeVersion message. + * Verifies a GetRuntimeVersionRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RuntimeVersion.verify = function verify(message) { + GetRuntimeVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; return null; }; /** - * Creates a RuntimeVersion message from a plain object. Also converts values to their respective internal types. + * Creates a GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @returns {google.cloud.tpu.v2.GetRuntimeVersionRequest} GetRuntimeVersionRequest */ - RuntimeVersion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.RuntimeVersion) + GetRuntimeVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.GetRuntimeVersionRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.RuntimeVersion(); + var message = new $root.google.cloud.tpu.v2.GetRuntimeVersionRequest(); if (object.name != null) message.name = String(object.name); - if (object.version != null) - message.version = String(object.version); return message; }; /** - * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. + * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static - * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} message RuntimeVersion + * @param {google.cloud.tpu.v2.GetRuntimeVersionRequest} message GetRuntimeVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RuntimeVersion.toObject = function toObject(message, options) { + GetRuntimeVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.name = ""; - object.version = ""; - } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; return object; }; /** - * Converts this RuntimeVersion to JSON. + * Converts this GetRuntimeVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @instance * @returns {Object.} JSON object */ - RuntimeVersion.prototype.toJSON = function toJSON() { + GetRuntimeVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for RuntimeVersion + * Gets the default type url for GetRuntimeVersionRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @memberof google.cloud.tpu.v2.GetRuntimeVersionRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - RuntimeVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GetRuntimeVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.RuntimeVersion"; + return typeUrlPrefix + "/google.cloud.tpu.v2.GetRuntimeVersionRequest"; }; - return RuntimeVersion; + return GetRuntimeVersionRequest; })(); - v2alpha1.GetRuntimeVersionRequest = (function() { + v2.ListRuntimeVersionsRequest = (function() { /** - * Properties of a GetRuntimeVersionRequest. - * @memberof google.cloud.tpu.v2alpha1 - * @interface IGetRuntimeVersionRequest - * @property {string|null} [name] GetRuntimeVersionRequest name + * Properties of a ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2 + * @interface IListRuntimeVersionsRequest + * @property {string|null} [parent] ListRuntimeVersionsRequest parent + * @property {number|null} [pageSize] ListRuntimeVersionsRequest pageSize + * @property {string|null} [pageToken] ListRuntimeVersionsRequest pageToken + * @property {string|null} [filter] ListRuntimeVersionsRequest filter + * @property {string|null} [orderBy] ListRuntimeVersionsRequest orderBy */ /** - * Constructs a new GetRuntimeVersionRequest. - * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents a GetRuntimeVersionRequest. - * @implements IGetRuntimeVersionRequest + * Constructs a new ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a ListRuntimeVersionsRequest. + * @implements IListRuntimeVersionsRequest * @constructor - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest=} [properties] Properties to set */ - function GetRuntimeVersionRequest(properties) { + function ListRuntimeVersionsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14197,206 +14082,295 @@ } /** - * GetRuntimeVersionRequest name. - * @member {string} name - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * ListRuntimeVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @instance */ - GetRuntimeVersionRequest.prototype.name = ""; + ListRuntimeVersionsRequest.prototype.parent = ""; /** - * Creates a new GetRuntimeVersionRequest instance using the specified properties. + * ListRuntimeVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageSize = 0; + + /** + * ListRuntimeVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageToken = ""; + + /** + * ListRuntimeVersionsRequest filter. + * @member {string} filter + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.filter = ""; + + /** + * ListRuntimeVersionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListRuntimeVersionsRequest instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest instance + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest instance */ - GetRuntimeVersionRequest.create = function create(properties) { - return new GetRuntimeVersionRequest(properties); + ListRuntimeVersionsRequest.create = function create(properties) { + return new ListRuntimeVersionsRequest(properties); }; /** - * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetRuntimeVersionRequest.encode = function encode(message, writer) { + ListRuntimeVersionsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); return writer; }; /** - * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetRuntimeVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListRuntimeVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetRuntimeVersionRequest.decode = function decode(reader, length) { + ListRuntimeVersionsRequest.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.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListRuntimeVersionsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.parent = reader.string(); break; } - default: - reader.skipType(tag & 7); - break; - } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } return message; }; /** - * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetRuntimeVersionRequest.decodeDelimited = function decodeDelimited(reader) { + ListRuntimeVersionsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetRuntimeVersionRequest message. + * Verifies a ListRuntimeVersionsRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetRuntimeVersionRequest.verify = function verify(message) { + ListRuntimeVersionsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; return null; }; /** - * Creates a GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest */ - GetRuntimeVersionRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest) + ListRuntimeVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.ListRuntimeVersionsRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); - if (object.name != null) - message.name = String(object.name); + var message = new $root.google.cloud.tpu.v2.ListRuntimeVersionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); return message; }; /** - * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static - * @param {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} message GetRuntimeVersionRequest + * @param {google.cloud.tpu.v2.ListRuntimeVersionsRequest} message ListRuntimeVersionsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetRuntimeVersionRequest.toObject = function toObject(message, options) { + ListRuntimeVersionsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; return object; }; /** - * Converts this GetRuntimeVersionRequest to JSON. + * Converts this ListRuntimeVersionsRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @instance * @returns {Object.} JSON object */ - GetRuntimeVersionRequest.prototype.toJSON = function toJSON() { + ListRuntimeVersionsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetRuntimeVersionRequest + * Gets the default type url for ListRuntimeVersionsRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetRuntimeVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListRuntimeVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListRuntimeVersionsRequest"; }; - return GetRuntimeVersionRequest; + return ListRuntimeVersionsRequest; })(); - v2alpha1.ListRuntimeVersionsRequest = (function() { + v2.ListRuntimeVersionsResponse = (function() { /** - * Properties of a ListRuntimeVersionsRequest. - * @memberof google.cloud.tpu.v2alpha1 - * @interface IListRuntimeVersionsRequest - * @property {string|null} [parent] ListRuntimeVersionsRequest parent - * @property {number|null} [pageSize] ListRuntimeVersionsRequest pageSize - * @property {string|null} [pageToken] ListRuntimeVersionsRequest pageToken - * @property {string|null} [filter] ListRuntimeVersionsRequest filter - * @property {string|null} [orderBy] ListRuntimeVersionsRequest orderBy + * Properties of a ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2 + * @interface IListRuntimeVersionsResponse + * @property {Array.|null} [runtimeVersions] ListRuntimeVersionsResponse runtimeVersions + * @property {string|null} [nextPageToken] ListRuntimeVersionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListRuntimeVersionsResponse unreachable */ /** - * Constructs a new ListRuntimeVersionsRequest. - * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents a ListRuntimeVersionsRequest. - * @implements IListRuntimeVersionsRequest + * Constructs a new ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a ListRuntimeVersionsResponse. + * @implements IListRuntimeVersionsResponse * @constructor - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IListRuntimeVersionsResponse=} [properties] Properties to set */ - function ListRuntimeVersionsRequest(properties) { + function ListRuntimeVersionsResponse(properties) { + this.runtimeVersions = []; + this.unreachable = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14404,131 +14378,109 @@ } /** - * ListRuntimeVersionsRequest parent. - * @member {string} parent - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest - * @instance - */ - ListRuntimeVersionsRequest.prototype.parent = ""; - - /** - * ListRuntimeVersionsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest - * @instance - */ - ListRuntimeVersionsRequest.prototype.pageSize = 0; - - /** - * ListRuntimeVersionsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * ListRuntimeVersionsResponse runtimeVersions. + * @member {Array.} runtimeVersions + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @instance */ - ListRuntimeVersionsRequest.prototype.pageToken = ""; + ListRuntimeVersionsResponse.prototype.runtimeVersions = $util.emptyArray; /** - * ListRuntimeVersionsRequest filter. - * @member {string} filter - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * ListRuntimeVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @instance */ - ListRuntimeVersionsRequest.prototype.filter = ""; + ListRuntimeVersionsResponse.prototype.nextPageToken = ""; /** - * ListRuntimeVersionsRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * ListRuntimeVersionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @instance */ - ListRuntimeVersionsRequest.prototype.orderBy = ""; + ListRuntimeVersionsResponse.prototype.unreachable = $util.emptyArray; /** - * Creates a new ListRuntimeVersionsRequest instance using the specified properties. + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest instance + * @param {google.cloud.tpu.v2.IListRuntimeVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse instance */ - ListRuntimeVersionsRequest.create = function create(properties) { - return new ListRuntimeVersionsRequest(properties); + ListRuntimeVersionsResponse.create = function create(properties) { + return new ListRuntimeVersionsResponse(properties); }; /** - * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListRuntimeVersionsRequest.encode = function encode(message, writer) { + ListRuntimeVersionsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + if (message.runtimeVersions != null && message.runtimeVersions.length) + for (var i = 0; i < message.runtimeVersions.length; ++i) + $root.google.cloud.tpu.v2.RuntimeVersion.encode(message.runtimeVersions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); return writer; }; /** - * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ListRuntimeVersionsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {google.cloud.tpu.v2.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListRuntimeVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListRuntimeVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListRuntimeVersionsRequest.decode = function decode(reader, length) { + ListRuntimeVersionsResponse.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.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.ListRuntimeVersionsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.parent = reader.string(); + if (!(message.runtimeVersions && message.runtimeVersions.length)) + message.runtimeVersions = []; + message.runtimeVersions.push($root.google.cloud.tpu.v2.RuntimeVersion.decode(reader, reader.uint32())); break; } case 2: { - message.pageSize = reader.int32(); + message.nextPageToken = reader.string(); break; } case 3: { - message.pageToken = reader.string(); - break; - } - case 5: { - message.filter = reader.string(); - break; - } - case 6: { - message.orderBy = reader.string(); + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); break; } default: @@ -14540,159 +14492,175 @@ }; /** - * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListRuntimeVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + ListRuntimeVersionsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListRuntimeVersionsRequest message. + * Verifies a ListRuntimeVersionsResponse message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListRuntimeVersionsRequest.verify = function verify(message) { + ListRuntimeVersionsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; + if (message.runtimeVersions != null && message.hasOwnProperty("runtimeVersions")) { + if (!Array.isArray(message.runtimeVersions)) + return "runtimeVersions: array expected"; + for (var i = 0; i < message.runtimeVersions.length; ++i) { + var error = $root.google.cloud.tpu.v2.RuntimeVersion.verify(message.runtimeVersions[i]); + if (error) + return "runtimeVersions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } return null; }; /** - * Creates a ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @returns {google.cloud.tpu.v2.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse */ - ListRuntimeVersionsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest) + ListRuntimeVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.ListRuntimeVersionsResponse) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); + var message = new $root.google.cloud.tpu.v2.ListRuntimeVersionsResponse(); + if (object.runtimeVersions) { + if (!Array.isArray(object.runtimeVersions)) + throw TypeError(".google.cloud.tpu.v2.ListRuntimeVersionsResponse.runtimeVersions: array expected"); + message.runtimeVersions = []; + for (var i = 0; i < object.runtimeVersions.length; ++i) { + if (typeof object.runtimeVersions[i] !== "object") + throw TypeError(".google.cloud.tpu.v2.ListRuntimeVersionsResponse.runtimeVersions: object expected"); + message.runtimeVersions[i] = $root.google.cloud.tpu.v2.RuntimeVersion.fromObject(object.runtimeVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2.ListRuntimeVersionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } return message; }; /** - * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static - * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} message ListRuntimeVersionsRequest + * @param {google.cloud.tpu.v2.ListRuntimeVersionsResponse} message ListRuntimeVersionsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListRuntimeVersionsRequest.toObject = function toObject(message, options) { + ListRuntimeVersionsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - object.orderBy = ""; + if (options.arrays || options.defaults) { + object.runtimeVersions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.runtimeVersions && message.runtimeVersions.length) { + object.runtimeVersions = []; + for (var j = 0; j < message.runtimeVersions.length; ++j) + object.runtimeVersions[j] = $root.google.cloud.tpu.v2.RuntimeVersion.toObject(message.runtimeVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; return object; }; /** - * Converts this ListRuntimeVersionsRequest to JSON. + * Converts this ListRuntimeVersionsResponse to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @instance * @returns {Object.} JSON object */ - ListRuntimeVersionsRequest.prototype.toJSON = function toJSON() { + ListRuntimeVersionsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListRuntimeVersionsRequest + * Gets the default type url for ListRuntimeVersionsResponse * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @memberof google.cloud.tpu.v2.ListRuntimeVersionsResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListRuntimeVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListRuntimeVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest"; + return typeUrlPrefix + "/google.cloud.tpu.v2.ListRuntimeVersionsResponse"; }; - return ListRuntimeVersionsRequest; + return ListRuntimeVersionsResponse; })(); - v2alpha1.ListRuntimeVersionsResponse = (function() { + v2.OperationMetadata = (function() { /** - * Properties of a ListRuntimeVersionsResponse. - * @memberof google.cloud.tpu.v2alpha1 - * @interface IListRuntimeVersionsResponse - * @property {Array.|null} [runtimeVersions] ListRuntimeVersionsResponse runtimeVersions - * @property {string|null} [nextPageToken] ListRuntimeVersionsResponse nextPageToken - * @property {Array.|null} [unreachable] ListRuntimeVersionsResponse unreachable + * Properties of an OperationMetadata. + * @memberof google.cloud.tpu.v2 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion */ /** - * Constructs a new ListRuntimeVersionsResponse. - * @memberof google.cloud.tpu.v2alpha1 - * @classdesc Represents a ListRuntimeVersionsResponse. - * @implements IListRuntimeVersionsResponse + * Constructs a new OperationMetadata. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata * @constructor - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set + * @param {google.cloud.tpu.v2.IOperationMetadata=} [properties] Properties to set */ - function ListRuntimeVersionsResponse(properties) { - this.runtimeVersions = []; - this.unreachable = []; + function OperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14700,109 +14668,159 @@ } /** - * ListRuntimeVersionsResponse runtimeVersions. - * @member {Array.} runtimeVersions - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2.OperationMetadata * @instance */ - ListRuntimeVersionsResponse.prototype.runtimeVersions = $util.emptyArray; + OperationMetadata.prototype.createTime = null; /** - * ListRuntimeVersionsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.tpu.v2.OperationMetadata * @instance */ - ListRuntimeVersionsResponse.prototype.nextPageToken = ""; + OperationMetadata.prototype.endTime = null; /** - * ListRuntimeVersionsResponse unreachable. - * @member {Array.} unreachable - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.tpu.v2.OperationMetadata * @instance */ - ListRuntimeVersionsResponse.prototype.unreachable = $util.emptyArray; + OperationMetadata.prototype.target = ""; /** - * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.tpu.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.tpu.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.tpu.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.tpu.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. * @function create - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse instance + * @param {google.cloud.tpu.v2.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.OperationMetadata} OperationMetadata instance */ - ListRuntimeVersionsResponse.create = function create(properties) { - return new ListRuntimeVersionsResponse(properties); + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); }; /** - * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2.OperationMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListRuntimeVersionsResponse.encode = function encode(message, writer) { + OperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.runtimeVersions != null && message.runtimeVersions.length) - for (var i = 0; i < message.runtimeVersions.length; ++i) - $root.google.cloud.tpu.v2alpha1.RuntimeVersion.encode(message.runtimeVersions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.unreachable != null && message.unreachable.length) - for (var i = 0; i < message.unreachable.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); return writer; }; /** - * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.OperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static - * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {google.cloud.tpu.v2.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListRuntimeVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @returns {google.cloud.tpu.v2.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListRuntimeVersionsResponse.decode = function decode(reader, length) { + OperationMetadata.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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.runtimeVersions && message.runtimeVersions.length)) - message.runtimeVersions = []; - message.runtimeVersions.push($root.google.cloud.tpu.v2alpha1.RuntimeVersion.decode(reader, reader.uint32())); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 2: { - message.nextPageToken = reader.string(); + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } case 3: { - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.statusDetail = reader.string(); + break; + } + case 6: { + message.cancelRequested = reader.bool(); + break; + } + case 7: { + message.apiVersion = reader.string(); break; } default: @@ -14814,149 +14832,14899 @@ }; /** - * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @returns {google.cloud.tpu.v2.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListRuntimeVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListRuntimeVersionsResponse message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListRuntimeVersionsResponse.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.runtimeVersions != null && message.hasOwnProperty("runtimeVersions")) { - if (!Array.isArray(message.runtimeVersions)) - return "runtimeVersions: array expected"; - for (var i = 0; i < message.runtimeVersions.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.verify(message.runtimeVersions[i]); - if (error) - return "runtimeVersions." + error; - } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.unreachable != null && message.hasOwnProperty("unreachable")) { - if (!Array.isArray(message.unreachable)) - return "unreachable: array expected"; - for (var i = 0; i < message.unreachable.length; ++i) - if (!$util.isString(message.unreachable[i])) - return "unreachable: string[] expected"; + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; return null; }; /** - * Creates a ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @returns {google.cloud.tpu.v2.OperationMetadata} OperationMetadata */ - ListRuntimeVersionsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.OperationMetadata) return object; - var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); - if (object.runtimeVersions) { - if (!Array.isArray(object.runtimeVersions)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: array expected"); - message.runtimeVersions = []; - for (var i = 0; i < object.runtimeVersions.length; ++i) { - if (typeof object.runtimeVersions[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: object expected"); - message.runtimeVersions[i] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.fromObject(object.runtimeVersions[i]); - } + var message = new $root.google.cloud.tpu.v2.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.unreachable) { - if (!Array.isArray(object.unreachable)) - throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.unreachable: array expected"); - message.unreachable = []; - for (var i = 0; i < object.unreachable.length; ++i) - message.unreachable[i] = String(object.unreachable[i]); + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.tpu.v2.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); return message; }; /** - * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2.OperationMetadata * @static - * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} message ListRuntimeVersionsResponse + * @param {google.cloud.tpu.v2.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListRuntimeVersionsResponse.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.runtimeVersions = []; - object.unreachable = []; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; } - if (options.defaults) - object.nextPageToken = ""; - if (message.runtimeVersions && message.runtimeVersions.length) { - object.runtimeVersions = []; - for (var j = 0; j < message.runtimeVersions.length; ++j) - object.runtimeVersions[j] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.toObject(message.runtimeVersions[j], options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.tpu.v2.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.unreachable && message.unreachable.length) { - object.unreachable = []; - for (var j = 0; j < message.unreachable.length; ++j) - object.unreachable[j] = message.unreachable[j]; + return typeUrlPrefix + "/google.cloud.tpu.v2.OperationMetadata"; + }; + + return OperationMetadata; + })(); + + v2.Symptom = (function() { + + /** + * Properties of a Symptom. + * @memberof google.cloud.tpu.v2 + * @interface ISymptom + * @property {google.protobuf.ITimestamp|null} [createTime] Symptom createTime + * @property {google.cloud.tpu.v2.Symptom.SymptomType|null} [symptomType] Symptom symptomType + * @property {string|null} [details] Symptom details + * @property {string|null} [workerId] Symptom workerId + */ + + /** + * Constructs a new Symptom. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a Symptom. + * @implements ISymptom + * @constructor + * @param {google.cloud.tpu.v2.ISymptom=} [properties] Properties to set + */ + function Symptom(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]]; + } + + /** + * Symptom createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2.Symptom + * @instance + */ + Symptom.prototype.createTime = null; + + /** + * Symptom symptomType. + * @member {google.cloud.tpu.v2.Symptom.SymptomType} symptomType + * @memberof google.cloud.tpu.v2.Symptom + * @instance + */ + Symptom.prototype.symptomType = 0; + + /** + * Symptom details. + * @member {string} details + * @memberof google.cloud.tpu.v2.Symptom + * @instance + */ + Symptom.prototype.details = ""; + + /** + * Symptom workerId. + * @member {string} workerId + * @memberof google.cloud.tpu.v2.Symptom + * @instance + */ + Symptom.prototype.workerId = ""; + + /** + * Creates a new Symptom instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {google.cloud.tpu.v2.ISymptom=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.Symptom} Symptom instance + */ + Symptom.create = function create(properties) { + return new Symptom(properties); + }; + + /** + * Encodes the specified Symptom message. Does not implicitly {@link google.cloud.tpu.v2.Symptom.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {google.cloud.tpu.v2.ISymptom} message Symptom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symptom.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.symptomType != null && Object.hasOwnProperty.call(message, "symptomType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.symptomType); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.details); + if (message.workerId != null && Object.hasOwnProperty.call(message, "workerId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.workerId); + return writer; + }; + + /** + * Encodes the specified Symptom message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.Symptom.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {google.cloud.tpu.v2.ISymptom} message Symptom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symptom.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symptom message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2.Symptom} Symptom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symptom.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.cloud.tpu.v2.Symptom(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.symptomType = reader.int32(); + break; + } + case 3: { + message.details = reader.string(); + break; + } + case 4: { + message.workerId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symptom message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2.Symptom} Symptom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symptom.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symptom message. + * @function verify + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symptom.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.symptomType != null && message.hasOwnProperty("symptomType")) + switch (message.symptomType) { + default: + return "symptomType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; + if (message.workerId != null && message.hasOwnProperty("workerId")) + if (!$util.isString(message.workerId)) + return "workerId: string expected"; + return null; + }; + + /** + * Creates a Symptom message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2.Symptom} Symptom + */ + Symptom.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.Symptom) + return object; + var message = new $root.google.cloud.tpu.v2.Symptom(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2.Symptom.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.symptomType) { + default: + if (typeof object.symptomType === "number") { + message.symptomType = object.symptomType; + break; + } + break; + case "SYMPTOM_TYPE_UNSPECIFIED": + case 0: + message.symptomType = 0; + break; + case "LOW_MEMORY": + case 1: + message.symptomType = 1; + break; + case "OUT_OF_MEMORY": + case 2: + message.symptomType = 2; + break; + case "EXECUTE_TIMED_OUT": + case 3: + message.symptomType = 3; + break; + case "MESH_BUILD_FAIL": + case 4: + message.symptomType = 4; + break; + case "HBM_OUT_OF_MEMORY": + case 5: + message.symptomType = 5; + break; + case "PROJECT_ABUSE": + case 6: + message.symptomType = 6; + break; + } + if (object.details != null) + message.details = String(object.details); + if (object.workerId != null) + message.workerId = String(object.workerId); + return message; + }; + + /** + * Creates a plain object from a Symptom message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {google.cloud.tpu.v2.Symptom} message Symptom + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symptom.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.symptomType = options.enums === String ? "SYMPTOM_TYPE_UNSPECIFIED" : 0; + object.details = ""; + object.workerId = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.symptomType != null && message.hasOwnProperty("symptomType")) + object.symptomType = options.enums === String ? $root.google.cloud.tpu.v2.Symptom.SymptomType[message.symptomType] === undefined ? message.symptomType : $root.google.cloud.tpu.v2.Symptom.SymptomType[message.symptomType] : message.symptomType; + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; + if (message.workerId != null && message.hasOwnProperty("workerId")) + object.workerId = message.workerId; + return object; + }; + + /** + * Converts this Symptom to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2.Symptom + * @instance + * @returns {Object.} JSON object + */ + Symptom.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Symptom + * @function getTypeUrl + * @memberof google.cloud.tpu.v2.Symptom + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Symptom.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2.Symptom"; + }; + + /** + * SymptomType enum. + * @name google.cloud.tpu.v2.Symptom.SymptomType + * @enum {number} + * @property {number} SYMPTOM_TYPE_UNSPECIFIED=0 SYMPTOM_TYPE_UNSPECIFIED value + * @property {number} LOW_MEMORY=1 LOW_MEMORY value + * @property {number} OUT_OF_MEMORY=2 OUT_OF_MEMORY value + * @property {number} EXECUTE_TIMED_OUT=3 EXECUTE_TIMED_OUT value + * @property {number} MESH_BUILD_FAIL=4 MESH_BUILD_FAIL value + * @property {number} HBM_OUT_OF_MEMORY=5 HBM_OUT_OF_MEMORY value + * @property {number} PROJECT_ABUSE=6 PROJECT_ABUSE value + */ + Symptom.SymptomType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SYMPTOM_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOW_MEMORY"] = 1; + values[valuesById[2] = "OUT_OF_MEMORY"] = 2; + values[valuesById[3] = "EXECUTE_TIMED_OUT"] = 3; + values[valuesById[4] = "MESH_BUILD_FAIL"] = 4; + values[valuesById[5] = "HBM_OUT_OF_MEMORY"] = 5; + values[valuesById[6] = "PROJECT_ABUSE"] = 6; + return values; + })(); + + return Symptom; + })(); + + v2.GetGuestAttributesRequest = (function() { + + /** + * Properties of a GetGuestAttributesRequest. + * @memberof google.cloud.tpu.v2 + * @interface IGetGuestAttributesRequest + * @property {string|null} [name] GetGuestAttributesRequest name + * @property {string|null} [queryPath] GetGuestAttributesRequest queryPath + * @property {Array.|null} [workerIds] GetGuestAttributesRequest workerIds + */ + + /** + * Constructs a new GetGuestAttributesRequest. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a GetGuestAttributesRequest. + * @implements IGetGuestAttributesRequest + * @constructor + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest=} [properties] Properties to set + */ + function GetGuestAttributesRequest(properties) { + this.workerIds = []; + 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]]; + } + + /** + * GetGuestAttributesRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.name = ""; + + /** + * GetGuestAttributesRequest queryPath. + * @member {string} queryPath + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.queryPath = ""; + + /** + * GetGuestAttributesRequest workerIds. + * @member {Array.} workerIds + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @instance + */ + GetGuestAttributesRequest.prototype.workerIds = $util.emptyArray; + + /** + * Creates a new GetGuestAttributesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GetGuestAttributesRequest} GetGuestAttributesRequest instance + */ + GetGuestAttributesRequest.create = function create(properties) { + return new GetGuestAttributesRequest(properties); + }; + + /** + * Encodes the specified GetGuestAttributesRequest message. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest} message GetGuestAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.queryPath != null && Object.hasOwnProperty.call(message, "queryPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queryPath); + if (message.workerIds != null && message.workerIds.length) + for (var i = 0; i < message.workerIds.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.workerIds[i]); + return writer; + }; + + /** + * Encodes the specified GetGuestAttributesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesRequest} message GetGuestAttributesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2.GetGuestAttributesRequest} GetGuestAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesRequest.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.cloud.tpu.v2.GetGuestAttributesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.queryPath = reader.string(); + break; + } + case 3: { + if (!(message.workerIds && message.workerIds.length)) + message.workerIds = []; + message.workerIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGuestAttributesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2.GetGuestAttributesRequest} GetGuestAttributesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGuestAttributesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGuestAttributesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + if (!$util.isString(message.queryPath)) + return "queryPath: string expected"; + if (message.workerIds != null && message.hasOwnProperty("workerIds")) { + if (!Array.isArray(message.workerIds)) + return "workerIds: array expected"; + for (var i = 0; i < message.workerIds.length; ++i) + if (!$util.isString(message.workerIds[i])) + return "workerIds: string[] expected"; + } + return null; + }; + + /** + * Creates a GetGuestAttributesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2.GetGuestAttributesRequest} GetGuestAttributesRequest + */ + GetGuestAttributesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.GetGuestAttributesRequest) + return object; + var message = new $root.google.cloud.tpu.v2.GetGuestAttributesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.queryPath != null) + message.queryPath = String(object.queryPath); + if (object.workerIds) { + if (!Array.isArray(object.workerIds)) + throw TypeError(".google.cloud.tpu.v2.GetGuestAttributesRequest.workerIds: array expected"); + message.workerIds = []; + for (var i = 0; i < object.workerIds.length; ++i) + message.workerIds[i] = String(object.workerIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a GetGuestAttributesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {google.cloud.tpu.v2.GetGuestAttributesRequest} message GetGuestAttributesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGuestAttributesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.workerIds = []; + if (options.defaults) { + object.name = ""; + object.queryPath = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + object.queryPath = message.queryPath; + if (message.workerIds && message.workerIds.length) { + object.workerIds = []; + for (var j = 0; j < message.workerIds.length; ++j) + object.workerIds[j] = message.workerIds[j]; + } + return object; + }; + + /** + * Converts this GetGuestAttributesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @instance + * @returns {Object.} JSON object + */ + GetGuestAttributesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGuestAttributesRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2.GetGuestAttributesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGuestAttributesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2.GetGuestAttributesRequest"; + }; + + return GetGuestAttributesRequest; + })(); + + v2.GetGuestAttributesResponse = (function() { + + /** + * Properties of a GetGuestAttributesResponse. + * @memberof google.cloud.tpu.v2 + * @interface IGetGuestAttributesResponse + * @property {Array.|null} [guestAttributes] GetGuestAttributesResponse guestAttributes + */ + + /** + * Constructs a new GetGuestAttributesResponse. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a GetGuestAttributesResponse. + * @implements IGetGuestAttributesResponse + * @constructor + * @param {google.cloud.tpu.v2.IGetGuestAttributesResponse=} [properties] Properties to set + */ + function GetGuestAttributesResponse(properties) { + this.guestAttributes = []; + 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]]; + } + + /** + * GetGuestAttributesResponse guestAttributes. + * @member {Array.} guestAttributes + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @instance + */ + GetGuestAttributesResponse.prototype.guestAttributes = $util.emptyArray; + + /** + * Creates a new GetGuestAttributesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.GetGuestAttributesResponse} GetGuestAttributesResponse instance + */ + GetGuestAttributesResponse.create = function create(properties) { + return new GetGuestAttributesResponse(properties); + }; + + /** + * Encodes the specified GetGuestAttributesResponse message. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.guestAttributes != null && message.guestAttributes.length) + for (var i = 0; i < message.guestAttributes.length; ++i) + $root.google.cloud.tpu.v2.GuestAttributes.encode(message.guestAttributes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.GetGuestAttributesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.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.cloud.tpu.v2.GetGuestAttributesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.guestAttributes && message.guestAttributes.length)) + message.guestAttributes = []; + message.guestAttributes.push($root.google.cloud.tpu.v2.GuestAttributes.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGuestAttributesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGuestAttributesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.guestAttributes != null && message.hasOwnProperty("guestAttributes")) { + if (!Array.isArray(message.guestAttributes)) + return "guestAttributes: array expected"; + for (var i = 0; i < message.guestAttributes.length; ++i) { + var error = $root.google.cloud.tpu.v2.GuestAttributes.verify(message.guestAttributes[i]); + if (error) + return "guestAttributes." + error; + } + } + return null; + }; + + /** + * Creates a GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2.GetGuestAttributesResponse} GetGuestAttributesResponse + */ + GetGuestAttributesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.GetGuestAttributesResponse) + return object; + var message = new $root.google.cloud.tpu.v2.GetGuestAttributesResponse(); + if (object.guestAttributes) { + if (!Array.isArray(object.guestAttributes)) + throw TypeError(".google.cloud.tpu.v2.GetGuestAttributesResponse.guestAttributes: array expected"); + message.guestAttributes = []; + for (var i = 0; i < object.guestAttributes.length; ++i) { + if (typeof object.guestAttributes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2.GetGuestAttributesResponse.guestAttributes: object expected"); + message.guestAttributes[i] = $root.google.cloud.tpu.v2.GuestAttributes.fromObject(object.guestAttributes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2.GetGuestAttributesResponse} message GetGuestAttributesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGuestAttributesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.guestAttributes = []; + if (message.guestAttributes && message.guestAttributes.length) { + object.guestAttributes = []; + for (var j = 0; j < message.guestAttributes.length; ++j) + object.guestAttributes[j] = $root.google.cloud.tpu.v2.GuestAttributes.toObject(message.guestAttributes[j], options); + } + return object; + }; + + /** + * Converts this GetGuestAttributesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @instance + * @returns {Object.} JSON object + */ + GetGuestAttributesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGuestAttributesResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2.GetGuestAttributesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGuestAttributesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2.GetGuestAttributesResponse"; + }; + + return GetGuestAttributesResponse; + })(); + + v2.ShieldedInstanceConfig = (function() { + + /** + * Properties of a ShieldedInstanceConfig. + * @memberof google.cloud.tpu.v2 + * @interface IShieldedInstanceConfig + * @property {boolean|null} [enableSecureBoot] ShieldedInstanceConfig enableSecureBoot + */ + + /** + * Constructs a new ShieldedInstanceConfig. + * @memberof google.cloud.tpu.v2 + * @classdesc Represents a ShieldedInstanceConfig. + * @implements IShieldedInstanceConfig + * @constructor + * @param {google.cloud.tpu.v2.IShieldedInstanceConfig=} [properties] Properties to set + */ + function ShieldedInstanceConfig(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]]; + } + + /** + * ShieldedInstanceConfig enableSecureBoot. + * @member {boolean} enableSecureBoot + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @instance + */ + ShieldedInstanceConfig.prototype.enableSecureBoot = false; + + /** + * Creates a new ShieldedInstanceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {google.cloud.tpu.v2.IShieldedInstanceConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2.ShieldedInstanceConfig} ShieldedInstanceConfig instance + */ + ShieldedInstanceConfig.create = function create(properties) { + return new ShieldedInstanceConfig(properties); + }; + + /** + * Encodes the specified ShieldedInstanceConfig message. Does not implicitly {@link google.cloud.tpu.v2.ShieldedInstanceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {google.cloud.tpu.v2.IShieldedInstanceConfig} message ShieldedInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShieldedInstanceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableSecureBoot != null && Object.hasOwnProperty.call(message, "enableSecureBoot")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enableSecureBoot); + return writer; + }; + + /** + * Encodes the specified ShieldedInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2.ShieldedInstanceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {google.cloud.tpu.v2.IShieldedInstanceConfig} message ShieldedInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShieldedInstanceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2.ShieldedInstanceConfig} ShieldedInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShieldedInstanceConfig.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.cloud.tpu.v2.ShieldedInstanceConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.enableSecureBoot = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShieldedInstanceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2.ShieldedInstanceConfig} ShieldedInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShieldedInstanceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShieldedInstanceConfig message. + * @function verify + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShieldedInstanceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableSecureBoot != null && message.hasOwnProperty("enableSecureBoot")) + if (typeof message.enableSecureBoot !== "boolean") + return "enableSecureBoot: boolean expected"; + return null; + }; + + /** + * Creates a ShieldedInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2.ShieldedInstanceConfig} ShieldedInstanceConfig + */ + ShieldedInstanceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2.ShieldedInstanceConfig) + return object; + var message = new $root.google.cloud.tpu.v2.ShieldedInstanceConfig(); + if (object.enableSecureBoot != null) + message.enableSecureBoot = Boolean(object.enableSecureBoot); + return message; + }; + + /** + * Creates a plain object from a ShieldedInstanceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {google.cloud.tpu.v2.ShieldedInstanceConfig} message ShieldedInstanceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShieldedInstanceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.enableSecureBoot = false; + if (message.enableSecureBoot != null && message.hasOwnProperty("enableSecureBoot")) + object.enableSecureBoot = message.enableSecureBoot; + return object; + }; + + /** + * Converts this ShieldedInstanceConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @instance + * @returns {Object.} JSON object + */ + ShieldedInstanceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ShieldedInstanceConfig + * @function getTypeUrl + * @memberof google.cloud.tpu.v2.ShieldedInstanceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShieldedInstanceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2.ShieldedInstanceConfig"; + }; + + return ShieldedInstanceConfig; + })(); + + return v2; + })(); + + tpu.v2alpha1 = (function() { + + /** + * Namespace v2alpha1. + * @memberof google.cloud.tpu + * @namespace + */ + var v2alpha1 = {}; + + v2alpha1.Tpu = (function() { + + /** + * Constructs a new Tpu service. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Tpu + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Tpu(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Tpu.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Tpu; + + /** + * Creates new Tpu service using the specified rpc implementation. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Tpu} RPC service. Useful where requests and/or responses are streamed. + */ + Tpu.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listNodes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListNodesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} [response] ListNodesResponse + */ + + /** + * Calls ListNodes. + * @function listNodes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListNodesCallback} callback Node-style callback called with the error, if any, and ListNodesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listNodes = function listNodes(request, callback) { + return this.rpcCall(listNodes, $root.google.cloud.tpu.v2alpha1.ListNodesRequest, $root.google.cloud.tpu.v2alpha1.ListNodesResponse, request, callback); + }, "name", { value: "ListNodes" }); + + /** + * Calls ListNodes. + * @function listNodes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} request ListNodesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.Node} [response] Node + */ + + /** + * Calls GetNode. + * @function getNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetNodeCallback} callback Node-style callback called with the error, if any, and Node + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getNode = function getNode(request, callback) { + return this.rpcCall(getNode, $root.google.cloud.tpu.v2alpha1.GetNodeRequest, $root.google.cloud.tpu.v2alpha1.Node, request, callback); + }, "name", { value: "GetNode" }); + + /** + * Calls GetNode. + * @function getNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} request GetNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef CreateNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateNode. + * @function createNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.CreateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.createNode = function createNode(request, callback) { + return this.rpcCall(createNode, $root.google.cloud.tpu.v2alpha1.CreateNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateNode" }); + + /** + * Calls CreateNode. + * @function createNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} request CreateNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef DeleteNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteNode. + * @function deleteNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.DeleteNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.deleteNode = function deleteNode(request, callback) { + return this.rpcCall(deleteNode, $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteNode" }); + + /** + * Calls DeleteNode. + * @function deleteNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} request DeleteNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|stopNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef StopNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls StopNode. + * @function stopNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.StopNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.stopNode = function stopNode(request, callback) { + return this.rpcCall(stopNode, $root.google.cloud.tpu.v2alpha1.StopNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "StopNode" }); + + /** + * Calls StopNode. + * @function stopNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} request StopNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|startNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef StartNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls StartNode. + * @function startNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.StartNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.startNode = function startNode(request, callback) { + return this.rpcCall(startNode, $root.google.cloud.tpu.v2alpha1.StartNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "StartNode" }); + + /** + * Calls StartNode. + * @function startNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} request StartNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|updateNode}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef UpdateNodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateNode. + * @function updateNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.UpdateNodeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.updateNode = function updateNode(request, callback) { + return this.rpcCall(updateNode, $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateNode" }); + + /** + * Calls UpdateNode. + * @function updateNode + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} request UpdateNodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listQueuedResources}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListQueuedResourcesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} [response] ListQueuedResourcesResponse + */ + + /** + * Calls ListQueuedResources. + * @function listQueuedResources + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest} request ListQueuedResourcesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListQueuedResourcesCallback} callback Node-style callback called with the error, if any, and ListQueuedResourcesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listQueuedResources = function listQueuedResources(request, callback) { + return this.rpcCall(listQueuedResources, $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest, $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse, request, callback); + }, "name", { value: "ListQueuedResources" }); + + /** + * Calls ListQueuedResources. + * @function listQueuedResources + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest} request ListQueuedResourcesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getQueuedResource}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetQueuedResourceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.QueuedResource} [response] QueuedResource + */ + + /** + * Calls GetQueuedResource. + * @function getQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest} request GetQueuedResourceRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetQueuedResourceCallback} callback Node-style callback called with the error, if any, and QueuedResource + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getQueuedResource = function getQueuedResource(request, callback) { + return this.rpcCall(getQueuedResource, $root.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest, $root.google.cloud.tpu.v2alpha1.QueuedResource, request, callback); + }, "name", { value: "GetQueuedResource" }); + + /** + * Calls GetQueuedResource. + * @function getQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest} request GetQueuedResourceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|createQueuedResource}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef CreateQueuedResourceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateQueuedResource. + * @function createQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest} request CreateQueuedResourceRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResourceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.createQueuedResource = function createQueuedResource(request, callback) { + return this.rpcCall(createQueuedResource, $root.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateQueuedResource" }); + + /** + * Calls CreateQueuedResource. + * @function createQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest} request CreateQueuedResourceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|deleteQueuedResource}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef DeleteQueuedResourceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteQueuedResource. + * @function deleteQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest} request DeleteQueuedResourceRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResourceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.deleteQueuedResource = function deleteQueuedResource(request, callback) { + return this.rpcCall(deleteQueuedResource, $root.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteQueuedResource" }); + + /** + * Calls DeleteQueuedResource. + * @function deleteQueuedResource + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest} request DeleteQueuedResourceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|generateServiceIdentity}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GenerateServiceIdentityCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} [response] GenerateServiceIdentityResponse + */ + + /** + * Calls GenerateServiceIdentity. + * @function generateServiceIdentity + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GenerateServiceIdentityCallback} callback Node-style callback called with the error, if any, and GenerateServiceIdentityResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.generateServiceIdentity = function generateServiceIdentity(request, callback) { + return this.rpcCall(generateServiceIdentity, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest, $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse, request, callback); + }, "name", { value: "GenerateServiceIdentity" }); + + /** + * Calls GenerateServiceIdentity. + * @function generateServiceIdentity + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} request GenerateServiceIdentityRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listAcceleratorTypes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListAcceleratorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} [response] ListAcceleratorTypesResponse + */ + + /** + * Calls ListAcceleratorTypes. + * @function listAcceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListAcceleratorTypesCallback} callback Node-style callback called with the error, if any, and ListAcceleratorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listAcceleratorTypes = function listAcceleratorTypes(request, callback) { + return this.rpcCall(listAcceleratorTypes, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest, $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse, request, callback); + }, "name", { value: "ListAcceleratorTypes" }); + + /** + * Calls ListAcceleratorTypes. + * @function listAcceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} request ListAcceleratorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getAcceleratorType}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetAcceleratorTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.AcceleratorType} [response] AcceleratorType + */ + + /** + * Calls GetAcceleratorType. + * @function getAcceleratorType + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetAcceleratorTypeCallback} callback Node-style callback called with the error, if any, and AcceleratorType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getAcceleratorType = function getAcceleratorType(request, callback) { + return this.rpcCall(getAcceleratorType, $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest, $root.google.cloud.tpu.v2alpha1.AcceleratorType, request, callback); + }, "name", { value: "GetAcceleratorType" }); + + /** + * Calls GetAcceleratorType. + * @function getAcceleratorType + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} request GetAcceleratorTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|listRuntimeVersions}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef ListRuntimeVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} [response] ListRuntimeVersionsResponse + */ + + /** + * Calls ListRuntimeVersions. + * @function listRuntimeVersions + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.ListRuntimeVersionsCallback} callback Node-style callback called with the error, if any, and ListRuntimeVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.listRuntimeVersions = function listRuntimeVersions(request, callback) { + return this.rpcCall(listRuntimeVersions, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest, $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse, request, callback); + }, "name", { value: "ListRuntimeVersions" }); + + /** + * Calls ListRuntimeVersions. + * @function listRuntimeVersions + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} request ListRuntimeVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getRuntimeVersion}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetRuntimeVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} [response] RuntimeVersion + */ + + /** + * Calls GetRuntimeVersion. + * @function getRuntimeVersion + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetRuntimeVersionCallback} callback Node-style callback called with the error, if any, and RuntimeVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getRuntimeVersion = function getRuntimeVersion(request, callback) { + return this.rpcCall(getRuntimeVersion, $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest, $root.google.cloud.tpu.v2alpha1.RuntimeVersion, request, callback); + }, "name", { value: "GetRuntimeVersion" }); + + /** + * Calls GetRuntimeVersion. + * @function getRuntimeVersion + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} request GetRuntimeVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|getGuestAttributes}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef GetGuestAttributesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} [response] GetGuestAttributesResponse + */ + + /** + * Calls GetGuestAttributes. + * @function getGuestAttributes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.GetGuestAttributesCallback} callback Node-style callback called with the error, if any, and GetGuestAttributesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.getGuestAttributes = function getGuestAttributes(request, callback) { + return this.rpcCall(getGuestAttributes, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesRequest, $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse, request, callback); + }, "name", { value: "GetGuestAttributes" }); + + /** + * Calls GetGuestAttributes. + * @function getGuestAttributes + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesRequest} request GetGuestAttributesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.tpu.v2alpha1.Tpu|simulateMaintenanceEvent}. + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @typedef SimulateMaintenanceEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SimulateMaintenanceEvent. + * @function simulateMaintenanceEvent + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest} request SimulateMaintenanceEventRequest message or plain object + * @param {google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEventCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Tpu.prototype.simulateMaintenanceEvent = function simulateMaintenanceEvent(request, callback) { + return this.rpcCall(simulateMaintenanceEvent, $root.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SimulateMaintenanceEvent" }); + + /** + * Calls SimulateMaintenanceEvent. + * @function simulateMaintenanceEvent + * @memberof google.cloud.tpu.v2alpha1.Tpu + * @instance + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest} request SimulateMaintenanceEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Tpu; + })(); + + v2alpha1.GuestAttributes = (function() { + + /** + * Properties of a GuestAttributes. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributes + * @property {string|null} [queryPath] GuestAttributes queryPath + * @property {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null} [queryValue] GuestAttributes queryValue + */ + + /** + * Constructs a new GuestAttributes. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributes. + * @implements IGuestAttributes + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set + */ + function GuestAttributes(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]]; + } + + /** + * GuestAttributes queryPath. + * @member {string} queryPath + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + */ + GuestAttributes.prototype.queryPath = ""; + + /** + * GuestAttributes queryValue. + * @member {google.cloud.tpu.v2alpha1.IGuestAttributesValue|null|undefined} queryValue + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + */ + GuestAttributes.prototype.queryValue = null; + + /** + * Creates a new GuestAttributes instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes instance + */ + GuestAttributes.create = function create(properties) { + return new GuestAttributes(properties); + }; + + /** + * Encodes the specified GuestAttributes message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributes.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryPath != null && Object.hasOwnProperty.call(message, "queryPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.queryPath); + if (message.queryValue != null && Object.hasOwnProperty.call(message, "queryValue")) + $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.encode(message.queryValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GuestAttributes message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributes.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributes} message GuestAttributes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributes.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributes.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.cloud.tpu.v2alpha1.GuestAttributes(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.queryPath = reader.string(); + break; + } + case 2: { + message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributes message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributes.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributes message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributes.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + if (!$util.isString(message.queryPath)) + return "queryPath: string expected"; + if (message.queryValue != null && message.hasOwnProperty("queryValue")) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.verify(message.queryValue); + if (error) + return "queryValue." + error; + } + return null; + }; + + /** + * Creates a GuestAttributes message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributes} GuestAttributes + */ + GuestAttributes.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributes) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributes(); + if (object.queryPath != null) + message.queryPath = String(object.queryPath); + if (object.queryValue != null) { + if (typeof object.queryValue !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributes.queryValue: object expected"); + message.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.fromObject(object.queryValue); + } + return message; + }; + + /** + * Creates a plain object from a GuestAttributes message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributes} message GuestAttributes + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributes.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.queryPath = ""; + object.queryValue = null; + } + if (message.queryPath != null && message.hasOwnProperty("queryPath")) + object.queryPath = message.queryPath; + if (message.queryValue != null && message.hasOwnProperty("queryValue")) + object.queryValue = $root.google.cloud.tpu.v2alpha1.GuestAttributesValue.toObject(message.queryValue, options); + return object; + }; + + /** + * Converts this GuestAttributes to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @instance + * @returns {Object.} JSON object + */ + GuestAttributes.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GuestAttributes + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GuestAttributes + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GuestAttributes.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributes"; + }; + + return GuestAttributes; + })(); + + v2alpha1.GuestAttributesValue = (function() { + + /** + * Properties of a GuestAttributesValue. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributesValue + * @property {Array.|null} [items] GuestAttributesValue items + */ + + /** + * Constructs a new GuestAttributesValue. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributesValue. + * @implements IGuestAttributesValue + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set + */ + function GuestAttributesValue(properties) { + this.items = []; + 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]]; + } + + /** + * GuestAttributesValue items. + * @member {Array.} items + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @instance + */ + GuestAttributesValue.prototype.items = $util.emptyArray; + + /** + * Creates a new GuestAttributesValue instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue instance + */ + GuestAttributesValue.create = function create(properties) { + return new GuestAttributesValue(properties); + }; + + /** + * Encodes the specified GuestAttributesValue message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GuestAttributesValue message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesValue} message GuestAttributesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesValue.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.cloud.tpu.v2alpha1.GuestAttributesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributesValue message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a GuestAttributesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesValue} GuestAttributesValue + */ + GuestAttributesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesValue) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesValue(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GuestAttributesValue.items: object expected"); + message.items[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GuestAttributesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributesValue} message GuestAttributesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this GuestAttributesValue to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @instance + * @returns {Object.} JSON object + */ + GuestAttributesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GuestAttributesValue + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GuestAttributesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributesValue"; + }; + + return GuestAttributesValue; + })(); + + v2alpha1.GuestAttributesEntry = (function() { + + /** + * Properties of a GuestAttributesEntry. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGuestAttributesEntry + * @property {string|null} [namespace] GuestAttributesEntry namespace + * @property {string|null} [key] GuestAttributesEntry key + * @property {string|null} [value] GuestAttributesEntry value + */ + + /** + * Constructs a new GuestAttributesEntry. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GuestAttributesEntry. + * @implements IGuestAttributesEntry + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set + */ + function GuestAttributesEntry(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]]; + } + + /** + * GuestAttributesEntry namespace. + * @member {string} namespace + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.namespace = ""; + + /** + * GuestAttributesEntry key. + * @member {string} key + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.key = ""; + + /** + * GuestAttributesEntry value. + * @member {string} value + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + */ + GuestAttributesEntry.prototype.value = ""; + + /** + * Creates a new GuestAttributesEntry instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry instance + */ + GuestAttributesEntry.create = function create(properties) { + return new GuestAttributesEntry(properties); + }; + + /** + * Encodes the specified GuestAttributesEntry message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namespace); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); + return writer; + }; + + /** + * Encodes the specified GuestAttributesEntry message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GuestAttributesEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.IGuestAttributesEntry} message GuestAttributesEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GuestAttributesEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesEntry.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.cloud.tpu.v2alpha1.GuestAttributesEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.namespace = reader.string(); + break; + } + case 2: { + message.key = reader.string(); + break; + } + case 3: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GuestAttributesEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GuestAttributesEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GuestAttributesEntry message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GuestAttributesEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.namespace != null && message.hasOwnProperty("namespace")) + if (!$util.isString(message.namespace)) + return "namespace: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a GuestAttributesEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GuestAttributesEntry} GuestAttributesEntry + */ + GuestAttributesEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GuestAttributesEntry(); + if (object.namespace != null) + message.namespace = String(object.namespace); + if (object.key != null) + message.key = String(object.key); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a GuestAttributesEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {google.cloud.tpu.v2alpha1.GuestAttributesEntry} message GuestAttributesEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GuestAttributesEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namespace = ""; + object.key = ""; + object.value = ""; + } + if (message.namespace != null && message.hasOwnProperty("namespace")) + object.namespace = message.namespace; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this GuestAttributesEntry to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @instance + * @returns {Object.} JSON object + */ + GuestAttributesEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GuestAttributesEntry + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GuestAttributesEntry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GuestAttributesEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GuestAttributesEntry"; + }; + + return GuestAttributesEntry; + })(); + + v2alpha1.AttachedDisk = (function() { + + /** + * Properties of an AttachedDisk. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAttachedDisk + * @property {string|null} [sourceDisk] AttachedDisk sourceDisk + * @property {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode|null} [mode] AttachedDisk mode + */ + + /** + * Constructs a new AttachedDisk. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AttachedDisk. + * @implements IAttachedDisk + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set + */ + function AttachedDisk(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]]; + } + + /** + * AttachedDisk sourceDisk. + * @member {string} sourceDisk + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + */ + AttachedDisk.prototype.sourceDisk = ""; + + /** + * AttachedDisk mode. + * @member {google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode} mode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + */ + AttachedDisk.prototype.mode = 0; + + /** + * Creates a new AttachedDisk instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk instance + */ + AttachedDisk.create = function create(properties) { + return new AttachedDisk(properties); + }; + + /** + * Encodes the specified AttachedDisk message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttachedDisk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceDisk != null && Object.hasOwnProperty.call(message, "sourceDisk")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sourceDisk); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified AttachedDisk message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AttachedDisk.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.IAttachedDisk} message AttachedDisk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AttachedDisk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttachedDisk.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.cloud.tpu.v2alpha1.AttachedDisk(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.sourceDisk = reader.string(); + break; + } + case 4: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AttachedDisk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AttachedDisk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AttachedDisk message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AttachedDisk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceDisk != null && message.hasOwnProperty("sourceDisk")) + if (!$util.isString(message.sourceDisk)) + return "sourceDisk: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an AttachedDisk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AttachedDisk} AttachedDisk + */ + AttachedDisk.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AttachedDisk) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AttachedDisk(); + if (object.sourceDisk != null) + message.sourceDisk = String(object.sourceDisk); + switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; + case "DISK_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "READ_WRITE": + case 1: + message.mode = 1; + break; + case "READ_ONLY": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an AttachedDisk message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {google.cloud.tpu.v2alpha1.AttachedDisk} message AttachedDisk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AttachedDisk.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sourceDisk = ""; + object.mode = options.enums === String ? "DISK_MODE_UNSPECIFIED" : 0; + } + if (message.sourceDisk != null && message.hasOwnProperty("sourceDisk")) + object.sourceDisk = message.sourceDisk; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode[message.mode] === undefined ? message.mode : $root.google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this AttachedDisk to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @instance + * @returns {Object.} JSON object + */ + AttachedDisk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AttachedDisk + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.AttachedDisk + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AttachedDisk.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AttachedDisk"; + }; + + /** + * DiskMode enum. + * @name google.cloud.tpu.v2alpha1.AttachedDisk.DiskMode + * @enum {number} + * @property {number} DISK_MODE_UNSPECIFIED=0 DISK_MODE_UNSPECIFIED value + * @property {number} READ_WRITE=1 READ_WRITE value + * @property {number} READ_ONLY=2 READ_ONLY value + */ + AttachedDisk.DiskMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DISK_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "READ_WRITE"] = 1; + values[valuesById[2] = "READ_ONLY"] = 2; + return values; + })(); + + return AttachedDisk; + })(); + + v2alpha1.SchedulingConfig = (function() { + + /** + * Properties of a SchedulingConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ISchedulingConfig + * @property {boolean|null} [preemptible] SchedulingConfig preemptible + * @property {boolean|null} [reserved] SchedulingConfig reserved + */ + + /** + * Constructs a new SchedulingConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a SchedulingConfig. + * @implements ISchedulingConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set + */ + function SchedulingConfig(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]]; + } + + /** + * SchedulingConfig preemptible. + * @member {boolean} preemptible + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + */ + SchedulingConfig.prototype.preemptible = false; + + /** + * SchedulingConfig reserved. + * @member {boolean} reserved + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + */ + SchedulingConfig.prototype.reserved = false; + + /** + * Creates a new SchedulingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig instance + */ + SchedulingConfig.create = function create(properties) { + return new SchedulingConfig(properties); + }; + + /** + * Encodes the specified SchedulingConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SchedulingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preemptible != null && Object.hasOwnProperty.call(message, "preemptible")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.preemptible); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.reserved); + return writer; + }; + + /** + * Encodes the specified SchedulingConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SchedulingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.ISchedulingConfig} message SchedulingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SchedulingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SchedulingConfig.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.cloud.tpu.v2alpha1.SchedulingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.preemptible = reader.bool(); + break; + } + case 2: { + message.reserved = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SchedulingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SchedulingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SchedulingConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SchedulingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preemptible != null && message.hasOwnProperty("preemptible")) + if (typeof message.preemptible !== "boolean") + return "preemptible: boolean expected"; + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + return null; + }; + + /** + * Creates a SchedulingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.SchedulingConfig} SchedulingConfig + */ + SchedulingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.SchedulingConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.SchedulingConfig(); + if (object.preemptible != null) + message.preemptible = Boolean(object.preemptible); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + return message; + }; + + /** + * Creates a plain object from a SchedulingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {google.cloud.tpu.v2alpha1.SchedulingConfig} message SchedulingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SchedulingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.preemptible = false; + object.reserved = false; + } + if (message.preemptible != null && message.hasOwnProperty("preemptible")) + object.preemptible = message.preemptible; + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + return object; + }; + + /** + * Converts this SchedulingConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @instance + * @returns {Object.} JSON object + */ + SchedulingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SchedulingConfig + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.SchedulingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SchedulingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.SchedulingConfig"; + }; + + return SchedulingConfig; + })(); + + v2alpha1.NetworkEndpoint = (function() { + + /** + * Properties of a NetworkEndpoint. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INetworkEndpoint + * @property {string|null} [ipAddress] NetworkEndpoint ipAddress + * @property {number|null} [port] NetworkEndpoint port + * @property {google.cloud.tpu.v2alpha1.IAccessConfig|null} [accessConfig] NetworkEndpoint accessConfig + */ + + /** + * Constructs a new NetworkEndpoint. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a NetworkEndpoint. + * @implements INetworkEndpoint + * @constructor + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set + */ + function NetworkEndpoint(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]]; + } + + /** + * NetworkEndpoint ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.ipAddress = ""; + + /** + * NetworkEndpoint port. + * @member {number} port + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.port = 0; + + /** + * NetworkEndpoint accessConfig. + * @member {google.cloud.tpu.v2alpha1.IAccessConfig|null|undefined} accessConfig + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + */ + NetworkEndpoint.prototype.accessConfig = null; + + /** + * Creates a new NetworkEndpoint instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint instance + */ + NetworkEndpoint.create = function create(properties) { + return new NetworkEndpoint(properties); + }; + + /** + * Encodes the specified NetworkEndpoint message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkEndpoint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ipAddress); + if (message.port != null && Object.hasOwnProperty.call(message, "port")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.port); + if (message.accessConfig != null && Object.hasOwnProperty.call(message, "accessConfig")) + $root.google.cloud.tpu.v2alpha1.AccessConfig.encode(message.accessConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NetworkEndpoint message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkEndpoint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkEndpoint} message NetworkEndpoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkEndpoint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkEndpoint.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.cloud.tpu.v2alpha1.NetworkEndpoint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ipAddress = reader.string(); + break; + } + case 2: { + message.port = reader.int32(); + break; + } + case 5: { + message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NetworkEndpoint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkEndpoint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NetworkEndpoint message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NetworkEndpoint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.port != null && message.hasOwnProperty("port")) + if (!$util.isInteger(message.port)) + return "port: integer expected"; + if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.AccessConfig.verify(message.accessConfig); + if (error) + return "accessConfig." + error; + } + return null; + }; + + /** + * Creates a NetworkEndpoint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.NetworkEndpoint} NetworkEndpoint + */ + NetworkEndpoint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkEndpoint) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.NetworkEndpoint(); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.port != null) + message.port = object.port | 0; + if (object.accessConfig != null) { + if (typeof object.accessConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.NetworkEndpoint.accessConfig: object expected"); + message.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.fromObject(object.accessConfig); + } + return message; + }; + + /** + * Creates a plain object from a NetworkEndpoint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {google.cloud.tpu.v2alpha1.NetworkEndpoint} message NetworkEndpoint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NetworkEndpoint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ipAddress = ""; + object.port = 0; + object.accessConfig = null; + } + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.port != null && message.hasOwnProperty("port")) + object.port = message.port; + if (message.accessConfig != null && message.hasOwnProperty("accessConfig")) + object.accessConfig = $root.google.cloud.tpu.v2alpha1.AccessConfig.toObject(message.accessConfig, options); + return object; + }; + + /** + * Converts this NetworkEndpoint to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @instance + * @returns {Object.} JSON object + */ + NetworkEndpoint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NetworkEndpoint + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.NetworkEndpoint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NetworkEndpoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.NetworkEndpoint"; + }; + + return NetworkEndpoint; + })(); + + v2alpha1.AccessConfig = (function() { + + /** + * Properties of an AccessConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAccessConfig + * @property {string|null} [externalIp] AccessConfig externalIp + */ + + /** + * Constructs a new AccessConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AccessConfig. + * @implements IAccessConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set + */ + function AccessConfig(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]]; + } + + /** + * AccessConfig externalIp. + * @member {string} externalIp + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @instance + */ + AccessConfig.prototype.externalIp = ""; + + /** + * Creates a new AccessConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig instance + */ + AccessConfig.create = function create(properties) { + return new AccessConfig(properties); + }; + + /** + * Encodes the specified AccessConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccessConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.externalIp != null && Object.hasOwnProperty.call(message, "externalIp")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.externalIp); + return writer; + }; + + /** + * Encodes the specified AccessConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AccessConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.IAccessConfig} message AccessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccessConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AccessConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccessConfig.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.cloud.tpu.v2alpha1.AccessConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.externalIp = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AccessConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccessConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AccessConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AccessConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.externalIp != null && message.hasOwnProperty("externalIp")) + if (!$util.isString(message.externalIp)) + return "externalIp: string expected"; + return null; + }; + + /** + * Creates an AccessConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AccessConfig} AccessConfig + */ + AccessConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AccessConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AccessConfig(); + if (object.externalIp != null) + message.externalIp = String(object.externalIp); + return message; + }; + + /** + * Creates a plain object from an AccessConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {google.cloud.tpu.v2alpha1.AccessConfig} message AccessConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AccessConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.externalIp = ""; + if (message.externalIp != null && message.hasOwnProperty("externalIp")) + object.externalIp = message.externalIp; + return object; + }; + + /** + * Converts this AccessConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @instance + * @returns {Object.} JSON object + */ + AccessConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AccessConfig + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.AccessConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AccessConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AccessConfig"; + }; + + return AccessConfig; + })(); + + v2alpha1.NetworkConfig = (function() { + + /** + * Properties of a NetworkConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INetworkConfig + * @property {string|null} [network] NetworkConfig network + * @property {string|null} [subnetwork] NetworkConfig subnetwork + * @property {boolean|null} [enableExternalIps] NetworkConfig enableExternalIps + * @property {boolean|null} [canIpForward] NetworkConfig canIpForward + */ + + /** + * Constructs a new NetworkConfig. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a NetworkConfig. + * @implements INetworkConfig + * @constructor + * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set + */ + function NetworkConfig(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]]; + } + + /** + * NetworkConfig network. + * @member {string} network + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.network = ""; + + /** + * NetworkConfig subnetwork. + * @member {string} subnetwork + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.subnetwork = ""; + + /** + * NetworkConfig enableExternalIps. + * @member {boolean} enableExternalIps + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.enableExternalIps = false; + + /** + * NetworkConfig canIpForward. + * @member {boolean} canIpForward + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + */ + NetworkConfig.prototype.canIpForward = false; + + /** + * Creates a new NetworkConfig instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig instance + */ + NetworkConfig.create = function create(properties) { + return new NetworkConfig(properties); + }; + + /** + * Encodes the specified NetworkConfig message. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.network != null && Object.hasOwnProperty.call(message, "network")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.network); + if (message.subnetwork != null && Object.hasOwnProperty.call(message, "subnetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subnetwork); + if (message.enableExternalIps != null && Object.hasOwnProperty.call(message, "enableExternalIps")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableExternalIps); + if (message.canIpForward != null && Object.hasOwnProperty.call(message, "canIpForward")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.canIpForward); + return writer; + }; + + /** + * Encodes the specified NetworkConfig message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.NetworkConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.INetworkConfig} message NetworkConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetworkConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkConfig.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.cloud.tpu.v2alpha1.NetworkConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.network = reader.string(); + break; + } + case 2: { + message.subnetwork = reader.string(); + break; + } + case 3: { + message.enableExternalIps = reader.bool(); + break; + } + case 4: { + message.canIpForward = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NetworkConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetworkConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NetworkConfig message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NetworkConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.network != null && message.hasOwnProperty("network")) + if (!$util.isString(message.network)) + return "network: string expected"; + if (message.subnetwork != null && message.hasOwnProperty("subnetwork")) + if (!$util.isString(message.subnetwork)) + return "subnetwork: string expected"; + if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) + if (typeof message.enableExternalIps !== "boolean") + return "enableExternalIps: boolean expected"; + if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) + if (typeof message.canIpForward !== "boolean") + return "canIpForward: boolean expected"; + return null; + }; + + /** + * Creates a NetworkConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.NetworkConfig} NetworkConfig + */ + NetworkConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.NetworkConfig) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.NetworkConfig(); + if (object.network != null) + message.network = String(object.network); + if (object.subnetwork != null) + message.subnetwork = String(object.subnetwork); + if (object.enableExternalIps != null) + message.enableExternalIps = Boolean(object.enableExternalIps); + if (object.canIpForward != null) + message.canIpForward = Boolean(object.canIpForward); + return message; + }; + + /** + * Creates a plain object from a NetworkConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {google.cloud.tpu.v2alpha1.NetworkConfig} message NetworkConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NetworkConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.network = ""; + object.subnetwork = ""; + object.enableExternalIps = false; + object.canIpForward = false; + } + if (message.network != null && message.hasOwnProperty("network")) + object.network = message.network; + if (message.subnetwork != null && message.hasOwnProperty("subnetwork")) + object.subnetwork = message.subnetwork; + if (message.enableExternalIps != null && message.hasOwnProperty("enableExternalIps")) + object.enableExternalIps = message.enableExternalIps; + if (message.canIpForward != null && message.hasOwnProperty("canIpForward")) + object.canIpForward = message.canIpForward; + return object; + }; + + /** + * Converts this NetworkConfig to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @instance + * @returns {Object.} JSON object + */ + NetworkConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NetworkConfig + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.NetworkConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NetworkConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.NetworkConfig"; + }; + + return NetworkConfig; + })(); + + v2alpha1.ServiceAccount = (function() { + + /** + * Properties of a ServiceAccount. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IServiceAccount + * @property {string|null} [email] ServiceAccount email + * @property {Array.|null} [scope] ServiceAccount scope + */ + + /** + * Constructs a new ServiceAccount. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ServiceAccount. + * @implements IServiceAccount + * @constructor + * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set + */ + function ServiceAccount(properties) { + this.scope = []; + 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]]; + } + + /** + * ServiceAccount email. + * @member {string} email + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + */ + ServiceAccount.prototype.email = ""; + + /** + * ServiceAccount scope. + * @member {Array.} scope + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + */ + ServiceAccount.prototype.scope = $util.emptyArray; + + /** + * Creates a new ServiceAccount instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount instance + */ + ServiceAccount.create = function create(properties) { + return new ServiceAccount(properties); + }; + + /** + * Encodes the specified ServiceAccount message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.email != null && Object.hasOwnProperty.call(message, "email")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.email); + if (message.scope != null && message.scope.length) + for (var i = 0; i < message.scope.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.scope[i]); + return writer; + }; + + /** + * Encodes the specified ServiceAccount message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceAccount} message ServiceAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceAccount.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.cloud.tpu.v2alpha1.ServiceAccount(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.email = reader.string(); + break; + } + case 2: { + if (!(message.scope && message.scope.length)) + message.scope = []; + message.scope.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceAccount message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.email != null && message.hasOwnProperty("email")) + if (!$util.isString(message.email)) + return "email: string expected"; + if (message.scope != null && message.hasOwnProperty("scope")) { + if (!Array.isArray(message.scope)) + return "scope: array expected"; + for (var i = 0; i < message.scope.length; ++i) + if (!$util.isString(message.scope[i])) + return "scope: string[] expected"; + } + return null; + }; + + /** + * Creates a ServiceAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ServiceAccount} ServiceAccount + */ + ServiceAccount.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceAccount) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ServiceAccount(); + if (object.email != null) + message.email = String(object.email); + if (object.scope) { + if (!Array.isArray(object.scope)) + throw TypeError(".google.cloud.tpu.v2alpha1.ServiceAccount.scope: array expected"); + message.scope = []; + for (var i = 0; i < object.scope.length; ++i) + message.scope[i] = String(object.scope[i]); + } + return message; + }; + + /** + * Creates a plain object from a ServiceAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {google.cloud.tpu.v2alpha1.ServiceAccount} message ServiceAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.scope = []; + if (options.defaults) + object.email = ""; + if (message.email != null && message.hasOwnProperty("email")) + object.email = message.email; + if (message.scope && message.scope.length) { + object.scope = []; + for (var j = 0; j < message.scope.length; ++j) + object.scope[j] = message.scope[j]; + } + return object; + }; + + /** + * Converts this ServiceAccount to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @instance + * @returns {Object.} JSON object + */ + ServiceAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceAccount + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ServiceAccount + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceAccount.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ServiceAccount"; + }; + + return ServiceAccount; + })(); + + v2alpha1.Node = (function() { + + /** + * Properties of a Node. + * @memberof google.cloud.tpu.v2alpha1 + * @interface INode + * @property {string|null} [name] Node name + * @property {string|null} [description] Node description + * @property {string|null} [acceleratorType] Node acceleratorType + * @property {google.cloud.tpu.v2alpha1.Node.State|null} [state] Node state + * @property {string|null} [healthDescription] Node healthDescription + * @property {string|null} [runtimeVersion] Node runtimeVersion + * @property {google.cloud.tpu.v2alpha1.INetworkConfig|null} [networkConfig] Node networkConfig + * @property {string|null} [cidrBlock] Node cidrBlock + * @property {google.cloud.tpu.v2alpha1.IServiceAccount|null} [serviceAccount] Node serviceAccount + * @property {google.protobuf.ITimestamp|null} [createTime] Node createTime + * @property {google.cloud.tpu.v2alpha1.ISchedulingConfig|null} [schedulingConfig] Node schedulingConfig + * @property {Array.|null} [networkEndpoints] Node networkEndpoints + * @property {google.cloud.tpu.v2alpha1.Node.Health|null} [health] Node health + * @property {Object.|null} [labels] Node labels + * @property {Object.|null} [metadata] Node metadata + * @property {Array.|null} [tags] Node tags + * @property {number|Long|null} [id] Node id + * @property {Array.|null} [dataDisks] Node dataDisks + * @property {google.cloud.tpu.v2alpha1.Node.ApiVersion|null} [apiVersion] Node apiVersion + * @property {Array.|null} [symptoms] Node symptoms + * @property {string|null} [queuedResource] Node queuedResource + * @property {google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null} [shieldedInstanceConfig] Node shieldedInstanceConfig + */ + + /** + * Constructs a new Node. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a Node. + * @implements INode + * @constructor + * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set + */ + function Node(properties) { + this.networkEndpoints = []; + this.labels = {}; + this.metadata = {}; + this.tags = []; + this.dataDisks = []; + this.symptoms = []; + 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]]; + } + + /** + * Node name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.name = ""; + + /** + * Node description. + * @member {string} description + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.description = ""; + + /** + * Node acceleratorType. + * @member {string} acceleratorType + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.acceleratorType = ""; + + /** + * Node state. + * @member {google.cloud.tpu.v2alpha1.Node.State} state + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.state = 0; + + /** + * Node healthDescription. + * @member {string} healthDescription + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.healthDescription = ""; + + /** + * Node runtimeVersion. + * @member {string} runtimeVersion + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.runtimeVersion = ""; + + /** + * Node networkConfig. + * @member {google.cloud.tpu.v2alpha1.INetworkConfig|null|undefined} networkConfig + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.networkConfig = null; + + /** + * Node cidrBlock. + * @member {string} cidrBlock + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.cidrBlock = ""; + + /** + * Node serviceAccount. + * @member {google.cloud.tpu.v2alpha1.IServiceAccount|null|undefined} serviceAccount + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.serviceAccount = null; + + /** + * Node createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.createTime = null; + + /** + * Node schedulingConfig. + * @member {google.cloud.tpu.v2alpha1.ISchedulingConfig|null|undefined} schedulingConfig + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.schedulingConfig = null; + + /** + * Node networkEndpoints. + * @member {Array.} networkEndpoints + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.networkEndpoints = $util.emptyArray; + + /** + * Node health. + * @member {google.cloud.tpu.v2alpha1.Node.Health} health + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.health = 0; + + /** + * Node labels. + * @member {Object.} labels + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.labels = $util.emptyObject; + + /** + * Node metadata. + * @member {Object.} metadata + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.metadata = $util.emptyObject; + + /** + * Node tags. + * @member {Array.} tags + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.tags = $util.emptyArray; + + /** + * Node id. + * @member {number|Long} id + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Node dataDisks. + * @member {Array.} dataDisks + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.dataDisks = $util.emptyArray; + + /** + * Node apiVersion. + * @member {google.cloud.tpu.v2alpha1.Node.ApiVersion} apiVersion + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.apiVersion = 0; + + /** + * Node symptoms. + * @member {Array.} symptoms + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.symptoms = $util.emptyArray; + + /** + * Node queuedResource. + * @member {string} queuedResource + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.queuedResource = ""; + + /** + * Node shieldedInstanceConfig. + * @member {google.cloud.tpu.v2alpha1.IShieldedInstanceConfig|null|undefined} shieldedInstanceConfig + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + */ + Node.prototype.shieldedInstanceConfig = null; + + /** + * Creates a new Node instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.Node} Node instance + */ + Node.create = function create(properties) { + return new Node(properties); + }; + + /** + * Encodes the specified Node message. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Node.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.acceleratorType != null && Object.hasOwnProperty.call(message, "acceleratorType")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.acceleratorType); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.healthDescription != null && Object.hasOwnProperty.call(message, "healthDescription")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.healthDescription); + if (message.runtimeVersion != null && Object.hasOwnProperty.call(message, "runtimeVersion")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.runtimeVersion); + if (message.cidrBlock != null && Object.hasOwnProperty.call(message, "cidrBlock")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.cidrBlock); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.schedulingConfig != null && Object.hasOwnProperty.call(message, "schedulingConfig")) + $root.google.cloud.tpu.v2alpha1.SchedulingConfig.encode(message.schedulingConfig, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.networkEndpoints != null && message.networkEndpoints.length) + for (var i = 0; i < message.networkEndpoints.length; ++i) + $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.encode(message.networkEndpoints[i], writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.health != null && Object.hasOwnProperty.call(message, "health")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.health); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 24, wireType 2 =*/194).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 33, wireType 0 =*/264).int64(message.id); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.networkConfig != null && Object.hasOwnProperty.call(message, "networkConfig")) + $root.google.cloud.tpu.v2alpha1.NetworkConfig.encode(message.networkConfig, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); + if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) + $root.google.cloud.tpu.v2alpha1.ServiceAccount.encode(message.serviceAccount, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 38, wireType 0 =*/304).int32(message.apiVersion); + if (message.symptoms != null && message.symptoms.length) + for (var i = 0; i < message.symptoms.length; ++i) + $root.google.cloud.tpu.v2alpha1.Symptom.encode(message.symptoms[i], writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.tags != null && message.tags.length) + for (var i = 0; i < message.tags.length; ++i) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.tags[i]); + if (message.dataDisks != null && message.dataDisks.length) + for (var i = 0; i < message.dataDisks.length; ++i) + $root.google.cloud.tpu.v2alpha1.AttachedDisk.encode(message.dataDisks[i], writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + if (message.queuedResource != null && Object.hasOwnProperty.call(message, "queuedResource")) + writer.uint32(/* id 43, wireType 2 =*/346).string(message.queuedResource); + if (message.shieldedInstanceConfig != null && Object.hasOwnProperty.call(message, "shieldedInstanceConfig")) + $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.encode(message.shieldedInstanceConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Node message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.Node.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.INode} message Node message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Node.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Node message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Node.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.cloud.tpu.v2alpha1.Node(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 5: { + message.acceleratorType = reader.string(); + break; + } + case 9: { + message.state = reader.int32(); + break; + } + case 10: { + message.healthDescription = reader.string(); + break; + } + case 11: { + message.runtimeVersion = reader.string(); + break; + } + case 36: { + message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.decode(reader, reader.uint32()); + break; + } + case 13: { + message.cidrBlock = reader.string(); + break; + } + case 37: { + message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.decode(reader, reader.uint32()); + break; + } + case 16: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 17: { + message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.decode(reader, reader.uint32()); + break; + } + case 21: { + if (!(message.networkEndpoints && message.networkEndpoints.length)) + message.networkEndpoints = []; + message.networkEndpoints.push($root.google.cloud.tpu.v2alpha1.NetworkEndpoint.decode(reader, reader.uint32())); + break; + } + case 22: { + message.health = reader.int32(); + break; + } + case 24: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 34: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 40: { + if (!(message.tags && message.tags.length)) + message.tags = []; + message.tags.push(reader.string()); + break; + } + case 33: { + message.id = reader.int64(); + break; + } + case 41: { + if (!(message.dataDisks && message.dataDisks.length)) + message.dataDisks = []; + message.dataDisks.push($root.google.cloud.tpu.v2alpha1.AttachedDisk.decode(reader, reader.uint32())); + break; + } + case 38: { + message.apiVersion = reader.int32(); + break; + } + case 39: { + if (!(message.symptoms && message.symptoms.length)) + message.symptoms = []; + message.symptoms.push($root.google.cloud.tpu.v2alpha1.Symptom.decode(reader, reader.uint32())); + break; + } + case 43: { + message.queuedResource = reader.string(); + break; + } + case 45: { + message.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Node message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.Node} Node + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Node.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Node message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Node.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.acceleratorType != null && message.hasOwnProperty("acceleratorType")) + if (!$util.isString(message.acceleratorType)) + return "acceleratorType: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + break; + } + if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) + if (!$util.isString(message.healthDescription)) + return "healthDescription: string expected"; + if (message.runtimeVersion != null && message.hasOwnProperty("runtimeVersion")) + if (!$util.isString(message.runtimeVersion)) + return "runtimeVersion: string expected"; + if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.NetworkConfig.verify(message.networkConfig); + if (error) + return "networkConfig." + error; + } + if (message.cidrBlock != null && message.hasOwnProperty("cidrBlock")) + if (!$util.isString(message.cidrBlock)) + return "cidrBlock: string expected"; + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) { + var error = $root.google.cloud.tpu.v2alpha1.ServiceAccount.verify(message.serviceAccount); + if (error) + return "serviceAccount." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.verify(message.schedulingConfig); + if (error) + return "schedulingConfig." + error; + } + if (message.networkEndpoints != null && message.hasOwnProperty("networkEndpoints")) { + if (!Array.isArray(message.networkEndpoints)) + return "networkEndpoints: array expected"; + for (var i = 0; i < message.networkEndpoints.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.verify(message.networkEndpoints[i]); + if (error) + return "networkEndpoints." + error; + } + } + if (message.health != null && message.hasOwnProperty("health")) + switch (message.health) { + default: + return "health: enum value expected"; + case 0: + case 1: + case 3: + case 4: + case 5: + break; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!Array.isArray(message.tags)) + return "tags: array expected"; + for (var i = 0; i < message.tags.length; ++i) + if (!$util.isString(message.tags[i])) + return "tags: string[] expected"; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.dataDisks != null && message.hasOwnProperty("dataDisks")) { + if (!Array.isArray(message.dataDisks)) + return "dataDisks: array expected"; + for (var i = 0; i < message.dataDisks.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.AttachedDisk.verify(message.dataDisks[i]); + if (error) + return "dataDisks." + error; + } + } + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + switch (message.apiVersion) { + default: + return "apiVersion: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.symptoms != null && message.hasOwnProperty("symptoms")) { + if (!Array.isArray(message.symptoms)) + return "symptoms: array expected"; + for (var i = 0; i < message.symptoms.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.Symptom.verify(message.symptoms[i]); + if (error) + return "symptoms." + error; + } + } + if (message.queuedResource != null && message.hasOwnProperty("queuedResource")) + if (!$util.isString(message.queuedResource)) + return "queuedResource: string expected"; + if (message.shieldedInstanceConfig != null && message.hasOwnProperty("shieldedInstanceConfig")) { + var error = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.verify(message.shieldedInstanceConfig); + if (error) + return "shieldedInstanceConfig." + error; + } + return null; + }; + + /** + * Creates a Node message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.Node} Node + */ + Node.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.Node) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.Node(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.acceleratorType != null) + message.acceleratorType = String(object.acceleratorType); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "READY": + case 2: + message.state = 2; + break; + case "RESTARTING": + case 3: + message.state = 3; + break; + case "REIMAGING": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + case "REPAIRING": + case 6: + message.state = 6; + break; + case "STOPPED": + case 8: + message.state = 8; + break; + case "STOPPING": + case 9: + message.state = 9; + break; + case "STARTING": + case 10: + message.state = 10; + break; + case "PREEMPTED": + case 11: + message.state = 11; + break; + case "TERMINATED": + case 12: + message.state = 12; + break; + case "HIDING": + case 13: + message.state = 13; + break; + case "HIDDEN": + case 14: + message.state = 14; + break; + case "UNHIDING": + case 15: + message.state = 15; + break; + } + if (object.healthDescription != null) + message.healthDescription = String(object.healthDescription); + if (object.runtimeVersion != null) + message.runtimeVersion = String(object.runtimeVersion); + if (object.networkConfig != null) { + if (typeof object.networkConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkConfig: object expected"); + message.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.fromObject(object.networkConfig); + } + if (object.cidrBlock != null) + message.cidrBlock = String(object.cidrBlock); + if (object.serviceAccount != null) { + if (typeof object.serviceAccount !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.serviceAccount: object expected"); + message.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.fromObject(object.serviceAccount); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.schedulingConfig != null) { + if (typeof object.schedulingConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.schedulingConfig: object expected"); + message.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.fromObject(object.schedulingConfig); + } + if (object.networkEndpoints) { + if (!Array.isArray(object.networkEndpoints)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: array expected"); + message.networkEndpoints = []; + for (var i = 0; i < object.networkEndpoints.length; ++i) { + if (typeof object.networkEndpoints[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.networkEndpoints: object expected"); + message.networkEndpoints[i] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.fromObject(object.networkEndpoints[i]); + } + } + switch (object.health) { + default: + if (typeof object.health === "number") { + message.health = object.health; + break; + } + break; + case "HEALTH_UNSPECIFIED": + case 0: + message.health = 0; + break; + case "HEALTHY": + case 1: + message.health = 1; + break; + case "TIMEOUT": + case 3: + message.health = 3; + break; + case "UNHEALTHY_TENSORFLOW": + case 4: + message.health = 4; + break; + case "UNHEALTHY_MAINTENANCE": + case 5: + message.health = 5; + break; + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.tags) { + if (!Array.isArray(object.tags)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.tags: array expected"); + message.tags = []; + for (var i = 0; i < object.tags.length; ++i) + message.tags[i] = String(object.tags[i]); + } + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.dataDisks) { + if (!Array.isArray(object.dataDisks)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: array expected"); + message.dataDisks = []; + for (var i = 0; i < object.dataDisks.length; ++i) { + if (typeof object.dataDisks[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.dataDisks: object expected"); + message.dataDisks[i] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.fromObject(object.dataDisks[i]); + } + } + switch (object.apiVersion) { + default: + if (typeof object.apiVersion === "number") { + message.apiVersion = object.apiVersion; + break; + } + break; + case "API_VERSION_UNSPECIFIED": + case 0: + message.apiVersion = 0; + break; + case "V1_ALPHA1": + case 1: + message.apiVersion = 1; + break; + case "V1": + case 2: + message.apiVersion = 2; + break; + case "V2_ALPHA1": + case 3: + message.apiVersion = 3; + break; + } + if (object.symptoms) { + if (!Array.isArray(object.symptoms)) + throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: array expected"); + message.symptoms = []; + for (var i = 0; i < object.symptoms.length; ++i) { + if (typeof object.symptoms[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.symptoms: object expected"); + message.symptoms[i] = $root.google.cloud.tpu.v2alpha1.Symptom.fromObject(object.symptoms[i]); + } + } + if (object.queuedResource != null) + message.queuedResource = String(object.queuedResource); + if (object.shieldedInstanceConfig != null) { + if (typeof object.shieldedInstanceConfig !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.Node.shieldedInstanceConfig: object expected"); + message.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.fromObject(object.shieldedInstanceConfig); + } + return message; + }; + + /** + * Creates a plain object from a Node message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {google.cloud.tpu.v2alpha1.Node} message Node + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Node.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.networkEndpoints = []; + object.symptoms = []; + object.tags = []; + object.dataDisks = []; + } + if (options.objects || options.defaults) { + object.labels = {}; + object.metadata = {}; + } + if (options.defaults) { + object.name = ""; + object.description = ""; + object.acceleratorType = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.healthDescription = ""; + object.runtimeVersion = ""; + object.cidrBlock = ""; + object.createTime = null; + object.schedulingConfig = null; + object.health = options.enums === String ? "HEALTH_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.networkConfig = null; + object.serviceAccount = null; + object.apiVersion = options.enums === String ? "API_VERSION_UNSPECIFIED" : 0; + object.queuedResource = ""; + object.shieldedInstanceConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.acceleratorType != null && message.hasOwnProperty("acceleratorType")) + object.acceleratorType = message.acceleratorType; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.State[message.state] === undefined ? message.state : $root.google.cloud.tpu.v2alpha1.Node.State[message.state] : message.state; + if (message.healthDescription != null && message.hasOwnProperty("healthDescription")) + object.healthDescription = message.healthDescription; + if (message.runtimeVersion != null && message.hasOwnProperty("runtimeVersion")) + object.runtimeVersion = message.runtimeVersion; + if (message.cidrBlock != null && message.hasOwnProperty("cidrBlock")) + object.cidrBlock = message.cidrBlock; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.schedulingConfig != null && message.hasOwnProperty("schedulingConfig")) + object.schedulingConfig = $root.google.cloud.tpu.v2alpha1.SchedulingConfig.toObject(message.schedulingConfig, options); + if (message.networkEndpoints && message.networkEndpoints.length) { + object.networkEndpoints = []; + for (var j = 0; j < message.networkEndpoints.length; ++j) + object.networkEndpoints[j] = $root.google.cloud.tpu.v2alpha1.NetworkEndpoint.toObject(message.networkEndpoints[j], options); + } + if (message.health != null && message.hasOwnProperty("health")) + object.health = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.Health[message.health] === undefined ? message.health : $root.google.cloud.tpu.v2alpha1.Node.Health[message.health] : message.health; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.networkConfig != null && message.hasOwnProperty("networkConfig")) + object.networkConfig = $root.google.cloud.tpu.v2alpha1.NetworkConfig.toObject(message.networkConfig, options); + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + object.serviceAccount = $root.google.cloud.tpu.v2alpha1.ServiceAccount.toObject(message.serviceAccount, options); + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = options.enums === String ? $root.google.cloud.tpu.v2alpha1.Node.ApiVersion[message.apiVersion] === undefined ? message.apiVersion : $root.google.cloud.tpu.v2alpha1.Node.ApiVersion[message.apiVersion] : message.apiVersion; + if (message.symptoms && message.symptoms.length) { + object.symptoms = []; + for (var j = 0; j < message.symptoms.length; ++j) + object.symptoms[j] = $root.google.cloud.tpu.v2alpha1.Symptom.toObject(message.symptoms[j], options); + } + if (message.tags && message.tags.length) { + object.tags = []; + for (var j = 0; j < message.tags.length; ++j) + object.tags[j] = message.tags[j]; + } + if (message.dataDisks && message.dataDisks.length) { + object.dataDisks = []; + for (var j = 0; j < message.dataDisks.length; ++j) + object.dataDisks[j] = $root.google.cloud.tpu.v2alpha1.AttachedDisk.toObject(message.dataDisks[j], options); + } + if (message.queuedResource != null && message.hasOwnProperty("queuedResource")) + object.queuedResource = message.queuedResource; + if (message.shieldedInstanceConfig != null && message.hasOwnProperty("shieldedInstanceConfig")) + object.shieldedInstanceConfig = $root.google.cloud.tpu.v2alpha1.ShieldedInstanceConfig.toObject(message.shieldedInstanceConfig, options); + return object; + }; + + /** + * Converts this Node to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.Node + * @instance + * @returns {Object.} JSON object + */ + Node.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Node + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.Node + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Node.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.Node"; + }; + + /** + * State enum. + * @name google.cloud.tpu.v2alpha1.Node.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} READY=2 READY value + * @property {number} RESTARTING=3 RESTARTING value + * @property {number} REIMAGING=4 REIMAGING value + * @property {number} DELETING=5 DELETING value + * @property {number} REPAIRING=6 REPAIRING value + * @property {number} STOPPED=8 STOPPED value + * @property {number} STOPPING=9 STOPPING value + * @property {number} STARTING=10 STARTING value + * @property {number} PREEMPTED=11 PREEMPTED value + * @property {number} TERMINATED=12 TERMINATED value + * @property {number} HIDING=13 HIDING value + * @property {number} HIDDEN=14 HIDDEN value + * @property {number} UNHIDING=15 UNHIDING value + */ + Node.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "RESTARTING"] = 3; + values[valuesById[4] = "REIMAGING"] = 4; + values[valuesById[5] = "DELETING"] = 5; + values[valuesById[6] = "REPAIRING"] = 6; + values[valuesById[8] = "STOPPED"] = 8; + values[valuesById[9] = "STOPPING"] = 9; + values[valuesById[10] = "STARTING"] = 10; + values[valuesById[11] = "PREEMPTED"] = 11; + values[valuesById[12] = "TERMINATED"] = 12; + values[valuesById[13] = "HIDING"] = 13; + values[valuesById[14] = "HIDDEN"] = 14; + values[valuesById[15] = "UNHIDING"] = 15; + return values; + })(); + + /** + * Health enum. + * @name google.cloud.tpu.v2alpha1.Node.Health + * @enum {number} + * @property {number} HEALTH_UNSPECIFIED=0 HEALTH_UNSPECIFIED value + * @property {number} HEALTHY=1 HEALTHY value + * @property {number} TIMEOUT=3 TIMEOUT value + * @property {number} UNHEALTHY_TENSORFLOW=4 UNHEALTHY_TENSORFLOW value + * @property {number} UNHEALTHY_MAINTENANCE=5 UNHEALTHY_MAINTENANCE value + */ + Node.Health = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HEALTH_UNSPECIFIED"] = 0; + values[valuesById[1] = "HEALTHY"] = 1; + values[valuesById[3] = "TIMEOUT"] = 3; + values[valuesById[4] = "UNHEALTHY_TENSORFLOW"] = 4; + values[valuesById[5] = "UNHEALTHY_MAINTENANCE"] = 5; + return values; + })(); + + /** + * ApiVersion enum. + * @name google.cloud.tpu.v2alpha1.Node.ApiVersion + * @enum {number} + * @property {number} API_VERSION_UNSPECIFIED=0 API_VERSION_UNSPECIFIED value + * @property {number} V1_ALPHA1=1 V1_ALPHA1 value + * @property {number} V1=2 V1 value + * @property {number} V2_ALPHA1=3 V2_ALPHA1 value + */ + Node.ApiVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "API_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "V1_ALPHA1"] = 1; + values[valuesById[2] = "V1"] = 2; + values[valuesById[3] = "V2_ALPHA1"] = 3; + return values; + })(); + + return Node; + })(); + + v2alpha1.QueuedResource = (function() { + + /** + * Properties of a QueuedResource. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IQueuedResource + * @property {string|null} [name] QueuedResource name + * @property {google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null} [tpu] QueuedResource tpu + * @property {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort|null} [bestEffort] QueuedResource bestEffort + * @property {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed|null} [guaranteed] QueuedResource guaranteed + * @property {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy|null} [queueingPolicy] QueuedResource queueingPolicy + * @property {google.cloud.tpu.v2alpha1.IQueuedResourceState|null} [state] QueuedResource state + */ + + /** + * Constructs a new QueuedResource. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a QueuedResource. + * @implements IQueuedResource + * @constructor + * @param {google.cloud.tpu.v2alpha1.IQueuedResource=} [properties] Properties to set + */ + function QueuedResource(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]]; + } + + /** + * QueuedResource name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.name = ""; + + /** + * QueuedResource tpu. + * @member {google.cloud.tpu.v2alpha1.QueuedResource.ITpu|null|undefined} tpu + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.tpu = null; + + /** + * QueuedResource bestEffort. + * @member {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort|null|undefined} bestEffort + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.bestEffort = null; + + /** + * QueuedResource guaranteed. + * @member {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed|null|undefined} guaranteed + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.guaranteed = null; + + /** + * QueuedResource queueingPolicy. + * @member {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy|null|undefined} queueingPolicy + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.queueingPolicy = null; + + /** + * QueuedResource state. + * @member {google.cloud.tpu.v2alpha1.IQueuedResourceState|null|undefined} state + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + QueuedResource.prototype.state = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueuedResource resource. + * @member {"tpu"|undefined} resource + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + Object.defineProperty(QueuedResource.prototype, "resource", { + get: $util.oneOfGetter($oneOfFields = ["tpu"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * QueuedResource tier. + * @member {"bestEffort"|"guaranteed"|undefined} tier + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + */ + Object.defineProperty(QueuedResource.prototype, "tier", { + get: $util.oneOfGetter($oneOfFields = ["bestEffort", "guaranteed"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueuedResource instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResource=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource} QueuedResource instance + */ + QueuedResource.create = function create(properties) { + return new QueuedResource(properties); + }; + + /** + * Encodes the specified QueuedResource message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResource} message QueuedResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueuedResource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.tpu != null && Object.hasOwnProperty.call(message, "tpu")) + $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.encode(message.tpu, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bestEffort != null && Object.hasOwnProperty.call(message, "bestEffort")) + $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.encode(message.bestEffort, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.guaranteed != null && Object.hasOwnProperty.call(message, "guaranteed")) + $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.encode(message.guaranteed, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.queueingPolicy != null && Object.hasOwnProperty.call(message, "queueingPolicy")) + $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.encode(message.queueingPolicy, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.encode(message.state, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueuedResource message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResource} message QueuedResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueuedResource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueuedResource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource} QueuedResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueuedResource.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.cloud.tpu.v2alpha1.QueuedResource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.tpu = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.decode(reader, reader.uint32()); + break; + } + case 3: { + message.bestEffort = $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.decode(reader, reader.uint32()); + break; + } + case 4: { + message.guaranteed = $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.decode(reader, reader.uint32()); + break; + } + case 5: { + message.queueingPolicy = $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueuedResource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource} QueuedResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueuedResource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueuedResource message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueuedResource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.tpu != null && message.hasOwnProperty("tpu")) { + properties.resource = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.verify(message.tpu); + if (error) + return "tpu." + error; + } + } + if (message.bestEffort != null && message.hasOwnProperty("bestEffort")) { + properties.tier = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.verify(message.bestEffort); + if (error) + return "bestEffort." + error; + } + } + if (message.guaranteed != null && message.hasOwnProperty("guaranteed")) { + if (properties.tier === 1) + return "tier: multiple values"; + properties.tier = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.verify(message.guaranteed); + if (error) + return "guaranteed." + error; + } + } + if (message.queueingPolicy != null && message.hasOwnProperty("queueingPolicy")) { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.verify(message.queueingPolicy); + if (error) + return "queueingPolicy." + error; + } + if (message.state != null && message.hasOwnProperty("state")) { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.verify(message.state); + if (error) + return "state." + error; + } + return null; + }; + + /** + * Creates a QueuedResource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource} QueuedResource + */ + QueuedResource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource(); + if (object.name != null) + message.name = String(object.name); + if (object.tpu != null) { + if (typeof object.tpu !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.tpu: object expected"); + message.tpu = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.fromObject(object.tpu); + } + if (object.bestEffort != null) { + if (typeof object.bestEffort !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.bestEffort: object expected"); + message.bestEffort = $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.fromObject(object.bestEffort); + } + if (object.guaranteed != null) { + if (typeof object.guaranteed !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.guaranteed: object expected"); + message.guaranteed = $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.fromObject(object.guaranteed); + } + if (object.queueingPolicy != null) { + if (typeof object.queueingPolicy !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.queueingPolicy: object expected"); + message.queueingPolicy = $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.fromObject(object.queueingPolicy); + } + if (object.state != null) { + if (typeof object.state !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.state: object expected"); + message.state = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.fromObject(object.state); + } + return message; + }; + + /** + * Creates a plain object from a QueuedResource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource} message QueuedResource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueuedResource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.queueingPolicy = null; + object.state = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.tpu != null && message.hasOwnProperty("tpu")) { + object.tpu = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.toObject(message.tpu, options); + if (options.oneofs) + object.resource = "tpu"; + } + if (message.bestEffort != null && message.hasOwnProperty("bestEffort")) { + object.bestEffort = $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.toObject(message.bestEffort, options); + if (options.oneofs) + object.tier = "bestEffort"; + } + if (message.guaranteed != null && message.hasOwnProperty("guaranteed")) { + object.guaranteed = $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.toObject(message.guaranteed, options); + if (options.oneofs) + object.tier = "guaranteed"; + } + if (message.queueingPolicy != null && message.hasOwnProperty("queueingPolicy")) + object.queueingPolicy = $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.toObject(message.queueingPolicy, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.toObject(message.state, options); + return object; + }; + + /** + * Converts this QueuedResource to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @instance + * @returns {Object.} JSON object + */ + QueuedResource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueuedResource + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueuedResource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource"; + }; + + QueuedResource.Tpu = (function() { + + /** + * Properties of a Tpu. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @interface ITpu + * @property {Array.|null} [nodeSpec] Tpu nodeSpec + */ + + /** + * Constructs a new Tpu. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @classdesc Represents a Tpu. + * @implements ITpu + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResource.ITpu=} [properties] Properties to set + */ + function Tpu(properties) { + this.nodeSpec = []; + 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]]; + } + + /** + * Tpu nodeSpec. + * @member {Array.} nodeSpec + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @instance + */ + Tpu.prototype.nodeSpec = $util.emptyArray; + + /** + * Creates a new Tpu instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.ITpu=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu} Tpu instance + */ + Tpu.create = function create(properties) { + return new Tpu(properties); + }; + + /** + * Encodes the specified Tpu message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.ITpu} message Tpu message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tpu.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nodeSpec != null && message.nodeSpec.length) + for (var i = 0; i < message.nodeSpec.length; ++i) + $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.encode(message.nodeSpec[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Tpu message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.ITpu} message Tpu message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tpu.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Tpu message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu} Tpu + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tpu.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.cloud.tpu.v2alpha1.QueuedResource.Tpu(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.nodeSpec && message.nodeSpec.length)) + message.nodeSpec = []; + message.nodeSpec.push($root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Tpu message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu} Tpu + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tpu.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Tpu message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Tpu.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.nodeSpec != null && message.hasOwnProperty("nodeSpec")) { + if (!Array.isArray(message.nodeSpec)) + return "nodeSpec: array expected"; + for (var i = 0; i < message.nodeSpec.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.verify(message.nodeSpec[i]); + if (error) + return "nodeSpec." + error; + } + } + return null; + }; + + /** + * Creates a Tpu message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu} Tpu + */ + Tpu.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu(); + if (object.nodeSpec) { + if (!Array.isArray(object.nodeSpec)) + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.Tpu.nodeSpec: array expected"); + message.nodeSpec = []; + for (var i = 0; i < object.nodeSpec.length; ++i) { + if (typeof object.nodeSpec[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.Tpu.nodeSpec: object expected"); + message.nodeSpec[i] = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.fromObject(object.nodeSpec[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Tpu message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu} message Tpu + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Tpu.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.nodeSpec = []; + if (message.nodeSpec && message.nodeSpec.length) { + object.nodeSpec = []; + for (var j = 0; j < message.nodeSpec.length; ++j) + object.nodeSpec[j] = $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.toObject(message.nodeSpec[j], options); + } + return object; + }; + + /** + * Converts this Tpu to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @instance + * @returns {Object.} JSON object + */ + Tpu.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Tpu + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Tpu.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.Tpu"; + }; + + Tpu.NodeSpec = (function() { + + /** + * Properties of a NodeSpec. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @interface INodeSpec + * @property {string|null} [parent] NodeSpec parent + * @property {string|null} [nodeId] NodeSpec nodeId + * @property {google.cloud.tpu.v2alpha1.INode|null} [node] NodeSpec node + */ + + /** + * Constructs a new NodeSpec. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu + * @classdesc Represents a NodeSpec. + * @implements INodeSpec + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec=} [properties] Properties to set + */ + function NodeSpec(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]]; + } + + /** + * NodeSpec parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @instance + */ + NodeSpec.prototype.parent = ""; + + /** + * NodeSpec nodeId. + * @member {string} nodeId + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @instance + */ + NodeSpec.prototype.nodeId = ""; + + /** + * NodeSpec node. + * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @instance + */ + NodeSpec.prototype.node = null; + + /** + * Creates a new NodeSpec instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec} NodeSpec instance + */ + NodeSpec.create = function create(properties) { + return new NodeSpec(properties); + }; + + /** + * Encodes the specified NodeSpec message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec} message NodeSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.nodeId != null && Object.hasOwnProperty.call(message, "nodeId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeId); + if (message.node != null && Object.hasOwnProperty.call(message, "node")) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NodeSpec message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.INodeSpec} message NodeSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NodeSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec} NodeSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSpec.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.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.nodeId = reader.string(); + break; + } + case 3: { + message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NodeSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec} NodeSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NodeSpec message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NodeSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + if (!$util.isString(message.nodeId)) + return "nodeId: string expected"; + if (message.node != null && message.hasOwnProperty("node")) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + if (error) + return "node." + error; + } + return null; + }; + + /** + * Creates a NodeSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec} NodeSpec + */ + NodeSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.nodeId != null) + message.nodeId = String(object.nodeId); + if (object.node != null) { + if (typeof object.node !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec.node: object expected"); + message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + } + return message; + }; + + /** + * Creates a plain object from a NodeSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec} message NodeSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NodeSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.nodeId = ""; + object.node = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + object.nodeId = message.nodeId; + if (message.node != null && message.hasOwnProperty("node")) + object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + return object; + }; + + /** + * Converts this NodeSpec to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @instance + * @returns {Object.} JSON object + */ + NodeSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NodeSpec + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NodeSpec.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.Tpu.NodeSpec"; + }; + + return NodeSpec; + })(); + + return Tpu; + })(); + + QueuedResource.BestEffort = (function() { + + /** + * Properties of a BestEffort. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @interface IBestEffort + */ + + /** + * Constructs a new BestEffort. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @classdesc Represents a BestEffort. + * @implements IBestEffort + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort=} [properties] Properties to set + */ + function BestEffort(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]]; + } + + /** + * Creates a new BestEffort instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.BestEffort} BestEffort instance + */ + BestEffort.create = function create(properties) { + return new BestEffort(properties); + }; + + /** + * Encodes the specified BestEffort message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort} message BestEffort message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BestEffort.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified BestEffort message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.BestEffort.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IBestEffort} message BestEffort message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BestEffort.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BestEffort message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.BestEffort} BestEffort + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BestEffort.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.cloud.tpu.v2alpha1.QueuedResource.BestEffort(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BestEffort message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.BestEffort} BestEffort + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BestEffort.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BestEffort message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BestEffort.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a BestEffort message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.BestEffort} BestEffort + */ + BestEffort.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResource.BestEffort(); + }; + + /** + * Creates a plain object from a BestEffort message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.BestEffort} message BestEffort + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BestEffort.toObject = function toObject() { + return {}; + }; + + /** + * Converts this BestEffort to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @instance + * @returns {Object.} JSON object + */ + BestEffort.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BestEffort + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.BestEffort + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BestEffort.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.BestEffort"; + }; + + return BestEffort; + })(); + + QueuedResource.Guaranteed = (function() { + + /** + * Properties of a Guaranteed. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @interface IGuaranteed + * @property {google.protobuf.IDuration|null} [minDuration] Guaranteed minDuration + * @property {boolean|null} [reserved] Guaranteed reserved + */ + + /** + * Constructs a new Guaranteed. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @classdesc Represents a Guaranteed. + * @implements IGuaranteed + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed=} [properties] Properties to set + */ + function Guaranteed(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]]; + } + + /** + * Guaranteed minDuration. + * @member {google.protobuf.IDuration|null|undefined} minDuration + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @instance + */ + Guaranteed.prototype.minDuration = null; + + /** + * Guaranteed reserved. + * @member {boolean} reserved + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @instance + */ + Guaranteed.prototype.reserved = false; + + /** + * Creates a new Guaranteed instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed} Guaranteed instance + */ + Guaranteed.create = function create(properties) { + return new Guaranteed(properties); + }; + + /** + * Encodes the specified Guaranteed message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed} message Guaranteed message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Guaranteed.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minDuration != null && Object.hasOwnProperty.call(message, "minDuration")) + $root.google.protobuf.Duration.encode(message.minDuration, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.reserved); + return writer; + }; + + /** + * Encodes the specified Guaranteed message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IGuaranteed} message Guaranteed message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Guaranteed.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Guaranteed message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed} Guaranteed + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Guaranteed.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.cloud.tpu.v2alpha1.QueuedResource.Guaranteed(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.minDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.reserved = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Guaranteed message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed} Guaranteed + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Guaranteed.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Guaranteed message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Guaranteed.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.minDuration != null && message.hasOwnProperty("minDuration")) { + var error = $root.google.protobuf.Duration.verify(message.minDuration); + if (error) + return "minDuration." + error; + } + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + return null; + }; + + /** + * Creates a Guaranteed message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed} Guaranteed + */ + Guaranteed.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed(); + if (object.minDuration != null) { + if (typeof object.minDuration !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed.minDuration: object expected"); + message.minDuration = $root.google.protobuf.Duration.fromObject(object.minDuration); + } + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + return message; + }; + + /** + * Creates a plain object from a Guaranteed message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed} message Guaranteed + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Guaranteed.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.minDuration = null; + object.reserved = false; + } + if (message.minDuration != null && message.hasOwnProperty("minDuration")) + object.minDuration = $root.google.protobuf.Duration.toObject(message.minDuration, options); + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + return object; + }; + + /** + * Converts this Guaranteed to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @instance + * @returns {Object.} JSON object + */ + Guaranteed.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Guaranteed + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Guaranteed.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.Guaranteed"; + }; + + return Guaranteed; + })(); + + QueuedResource.QueueingPolicy = (function() { + + /** + * Properties of a QueueingPolicy. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @interface IQueueingPolicy + * @property {google.protobuf.IDuration|null} [validUntilDuration] QueueingPolicy validUntilDuration + * @property {google.protobuf.ITimestamp|null} [validUntilTime] QueueingPolicy validUntilTime + * @property {google.protobuf.IDuration|null} [validAfterDuration] QueueingPolicy validAfterDuration + * @property {google.protobuf.ITimestamp|null} [validAfterTime] QueueingPolicy validAfterTime + * @property {google.type.IInterval|null} [validInterval] QueueingPolicy validInterval + */ + + /** + * Constructs a new QueueingPolicy. + * @memberof google.cloud.tpu.v2alpha1.QueuedResource + * @classdesc Represents a QueueingPolicy. + * @implements IQueueingPolicy + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy=} [properties] Properties to set + */ + function QueueingPolicy(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]]; + } + + /** + * QueueingPolicy validUntilDuration. + * @member {google.protobuf.IDuration|null|undefined} validUntilDuration + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + QueueingPolicy.prototype.validUntilDuration = null; + + /** + * QueueingPolicy validUntilTime. + * @member {google.protobuf.ITimestamp|null|undefined} validUntilTime + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + QueueingPolicy.prototype.validUntilTime = null; + + /** + * QueueingPolicy validAfterDuration. + * @member {google.protobuf.IDuration|null|undefined} validAfterDuration + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + QueueingPolicy.prototype.validAfterDuration = null; + + /** + * QueueingPolicy validAfterTime. + * @member {google.protobuf.ITimestamp|null|undefined} validAfterTime + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + QueueingPolicy.prototype.validAfterTime = null; + + /** + * QueueingPolicy validInterval. + * @member {google.type.IInterval|null|undefined} validInterval + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + QueueingPolicy.prototype.validInterval = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueueingPolicy startTimingConstraints. + * @member {"validUntilDuration"|"validUntilTime"|"validAfterDuration"|"validAfterTime"|"validInterval"|undefined} startTimingConstraints + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + */ + Object.defineProperty(QueueingPolicy.prototype, "startTimingConstraints", { + get: $util.oneOfGetter($oneOfFields = ["validUntilDuration", "validUntilTime", "validAfterDuration", "validAfterTime", "validInterval"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueueingPolicy instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy} QueueingPolicy instance + */ + QueueingPolicy.create = function create(properties) { + return new QueueingPolicy(properties); + }; + + /** + * Encodes the specified QueueingPolicy message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy} message QueueingPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueueingPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validUntilDuration != null && Object.hasOwnProperty.call(message, "validUntilDuration")) + $root.google.protobuf.Duration.encode(message.validUntilDuration, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.validUntilTime != null && Object.hasOwnProperty.call(message, "validUntilTime")) + $root.google.protobuf.Timestamp.encode(message.validUntilTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validAfterDuration != null && Object.hasOwnProperty.call(message, "validAfterDuration")) + $root.google.protobuf.Duration.encode(message.validAfterDuration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.validAfterTime != null && Object.hasOwnProperty.call(message, "validAfterTime")) + $root.google.protobuf.Timestamp.encode(message.validAfterTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.validInterval != null && Object.hasOwnProperty.call(message, "validInterval")) + $root.google.type.Interval.encode(message.validInterval, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueueingPolicy message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.IQueueingPolicy} message QueueingPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueueingPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueueingPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy} QueueingPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueueingPolicy.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.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.validUntilDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.validUntilTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.validAfterDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.validAfterTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.validInterval = $root.google.type.Interval.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueueingPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy} QueueingPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueueingPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueueingPolicy message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueueingPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.validUntilDuration != null && message.hasOwnProperty("validUntilDuration")) { + properties.startTimingConstraints = 1; + { + var error = $root.google.protobuf.Duration.verify(message.validUntilDuration); + if (error) + return "validUntilDuration." + error; + } + } + if (message.validUntilTime != null && message.hasOwnProperty("validUntilTime")) { + if (properties.startTimingConstraints === 1) + return "startTimingConstraints: multiple values"; + properties.startTimingConstraints = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.validUntilTime); + if (error) + return "validUntilTime." + error; + } + } + if (message.validAfterDuration != null && message.hasOwnProperty("validAfterDuration")) { + if (properties.startTimingConstraints === 1) + return "startTimingConstraints: multiple values"; + properties.startTimingConstraints = 1; + { + var error = $root.google.protobuf.Duration.verify(message.validAfterDuration); + if (error) + return "validAfterDuration." + error; + } + } + if (message.validAfterTime != null && message.hasOwnProperty("validAfterTime")) { + if (properties.startTimingConstraints === 1) + return "startTimingConstraints: multiple values"; + properties.startTimingConstraints = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.validAfterTime); + if (error) + return "validAfterTime." + error; + } + } + if (message.validInterval != null && message.hasOwnProperty("validInterval")) { + if (properties.startTimingConstraints === 1) + return "startTimingConstraints: multiple values"; + properties.startTimingConstraints = 1; + { + var error = $root.google.type.Interval.verify(message.validInterval); + if (error) + return "validInterval." + error; + } + } + return null; + }; + + /** + * Creates a QueueingPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy} QueueingPolicy + */ + QueueingPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy(); + if (object.validUntilDuration != null) { + if (typeof object.validUntilDuration !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.validUntilDuration: object expected"); + message.validUntilDuration = $root.google.protobuf.Duration.fromObject(object.validUntilDuration); + } + if (object.validUntilTime != null) { + if (typeof object.validUntilTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.validUntilTime: object expected"); + message.validUntilTime = $root.google.protobuf.Timestamp.fromObject(object.validUntilTime); + } + if (object.validAfterDuration != null) { + if (typeof object.validAfterDuration !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.validAfterDuration: object expected"); + message.validAfterDuration = $root.google.protobuf.Duration.fromObject(object.validAfterDuration); + } + if (object.validAfterTime != null) { + if (typeof object.validAfterTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.validAfterTime: object expected"); + message.validAfterTime = $root.google.protobuf.Timestamp.fromObject(object.validAfterTime); + } + if (object.validInterval != null) { + if (typeof object.validInterval !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy.validInterval: object expected"); + message.validInterval = $root.google.type.Interval.fromObject(object.validInterval); + } + return message; + }; + + /** + * Creates a plain object from a QueueingPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy} message QueueingPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueueingPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.validUntilDuration != null && message.hasOwnProperty("validUntilDuration")) { + object.validUntilDuration = $root.google.protobuf.Duration.toObject(message.validUntilDuration, options); + if (options.oneofs) + object.startTimingConstraints = "validUntilDuration"; + } + if (message.validUntilTime != null && message.hasOwnProperty("validUntilTime")) { + object.validUntilTime = $root.google.protobuf.Timestamp.toObject(message.validUntilTime, options); + if (options.oneofs) + object.startTimingConstraints = "validUntilTime"; + } + if (message.validAfterDuration != null && message.hasOwnProperty("validAfterDuration")) { + object.validAfterDuration = $root.google.protobuf.Duration.toObject(message.validAfterDuration, options); + if (options.oneofs) + object.startTimingConstraints = "validAfterDuration"; + } + if (message.validAfterTime != null && message.hasOwnProperty("validAfterTime")) { + object.validAfterTime = $root.google.protobuf.Timestamp.toObject(message.validAfterTime, options); + if (options.oneofs) + object.startTimingConstraints = "validAfterTime"; + } + if (message.validInterval != null && message.hasOwnProperty("validInterval")) { + object.validInterval = $root.google.type.Interval.toObject(message.validInterval, options); + if (options.oneofs) + object.startTimingConstraints = "validInterval"; + } + return object; + }; + + /** + * Converts this QueueingPolicy to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @instance + * @returns {Object.} JSON object + */ + QueueingPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueueingPolicy + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueueingPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResource.QueueingPolicy"; + }; + + return QueueingPolicy; + })(); + + return QueuedResource; + })(); + + v2alpha1.QueuedResourceState = (function() { + + /** + * Properties of a QueuedResourceState. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IQueuedResourceState + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.State|null} [state] QueuedResourceState state + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData|null} [creatingData] QueuedResourceState creatingData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData|null} [acceptedData] QueuedResourceState acceptedData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData|null} [provisioningData] QueuedResourceState provisioningData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData|null} [failedData] QueuedResourceState failedData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData|null} [deletingData] QueuedResourceState deletingData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData|null} [activeData] QueuedResourceState activeData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData|null} [suspendingData] QueuedResourceState suspendingData + * @property {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData|null} [suspendedData] QueuedResourceState suspendedData + */ + + /** + * Constructs a new QueuedResourceState. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a QueuedResourceState. + * @implements IQueuedResourceState + * @constructor + * @param {google.cloud.tpu.v2alpha1.IQueuedResourceState=} [properties] Properties to set + */ + function QueuedResourceState(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]]; + } + + /** + * QueuedResourceState state. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.State} state + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.state = 0; + + /** + * QueuedResourceState creatingData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData|null|undefined} creatingData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.creatingData = null; + + /** + * QueuedResourceState acceptedData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData|null|undefined} acceptedData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.acceptedData = null; + + /** + * QueuedResourceState provisioningData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData|null|undefined} provisioningData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.provisioningData = null; + + /** + * QueuedResourceState failedData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData|null|undefined} failedData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.failedData = null; + + /** + * QueuedResourceState deletingData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData|null|undefined} deletingData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.deletingData = null; + + /** + * QueuedResourceState activeData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData|null|undefined} activeData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.activeData = null; + + /** + * QueuedResourceState suspendingData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData|null|undefined} suspendingData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.suspendingData = null; + + /** + * QueuedResourceState suspendedData. + * @member {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData|null|undefined} suspendedData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + QueuedResourceState.prototype.suspendedData = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueuedResourceState stateData. + * @member {"creatingData"|"acceptedData"|"provisioningData"|"failedData"|"deletingData"|"activeData"|"suspendingData"|"suspendedData"|undefined} stateData + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + */ + Object.defineProperty(QueuedResourceState.prototype, "stateData", { + get: $util.oneOfGetter($oneOfFields = ["creatingData", "acceptedData", "provisioningData", "failedData", "deletingData", "activeData", "suspendingData", "suspendedData"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueuedResourceState instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResourceState=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState} QueuedResourceState instance + */ + QueuedResourceState.create = function create(properties) { + return new QueuedResourceState(properties); + }; + + /** + * Encodes the specified QueuedResourceState message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResourceState} message QueuedResourceState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueuedResourceState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.creatingData != null && Object.hasOwnProperty.call(message, "creatingData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.encode(message.creatingData, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.acceptedData != null && Object.hasOwnProperty.call(message, "acceptedData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.encode(message.acceptedData, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.provisioningData != null && Object.hasOwnProperty.call(message, "provisioningData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.encode(message.provisioningData, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.failedData != null && Object.hasOwnProperty.call(message, "failedData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.encode(message.failedData, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.deletingData != null && Object.hasOwnProperty.call(message, "deletingData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.encode(message.deletingData, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.activeData != null && Object.hasOwnProperty.call(message, "activeData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.encode(message.activeData, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.suspendingData != null && Object.hasOwnProperty.call(message, "suspendingData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.encode(message.suspendingData, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.suspendedData != null && Object.hasOwnProperty.call(message, "suspendedData")) + $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.encode(message.suspendedData, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueuedResourceState message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {google.cloud.tpu.v2alpha1.IQueuedResourceState} message QueuedResourceState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueuedResourceState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueuedResourceState message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState} QueuedResourceState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueuedResourceState.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.cloud.tpu.v2alpha1.QueuedResourceState(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.creatingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.decode(reader, reader.uint32()); + break; + } + case 3: { + message.acceptedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.decode(reader, reader.uint32()); + break; + } + case 4: { + message.provisioningData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.decode(reader, reader.uint32()); + break; + } + case 5: { + message.failedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.decode(reader, reader.uint32()); + break; + } + case 6: { + message.deletingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.decode(reader, reader.uint32()); + break; + } + case 7: { + message.activeData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.decode(reader, reader.uint32()); + break; + } + case 8: { + message.suspendingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.decode(reader, reader.uint32()); + break; + } + case 9: { + message.suspendedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueuedResourceState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState} QueuedResourceState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueuedResourceState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueuedResourceState message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueuedResourceState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.creatingData != null && message.hasOwnProperty("creatingData")) { + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.verify(message.creatingData); + if (error) + return "creatingData." + error; + } + } + if (message.acceptedData != null && message.hasOwnProperty("acceptedData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.verify(message.acceptedData); + if (error) + return "acceptedData." + error; + } + } + if (message.provisioningData != null && message.hasOwnProperty("provisioningData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.verify(message.provisioningData); + if (error) + return "provisioningData." + error; + } + } + if (message.failedData != null && message.hasOwnProperty("failedData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.verify(message.failedData); + if (error) + return "failedData." + error; + } + } + if (message.deletingData != null && message.hasOwnProperty("deletingData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.verify(message.deletingData); + if (error) + return "deletingData." + error; + } + } + if (message.activeData != null && message.hasOwnProperty("activeData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.verify(message.activeData); + if (error) + return "activeData." + error; + } + } + if (message.suspendingData != null && message.hasOwnProperty("suspendingData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.verify(message.suspendingData); + if (error) + return "suspendingData." + error; + } + } + if (message.suspendedData != null && message.hasOwnProperty("suspendedData")) { + if (properties.stateData === 1) + return "stateData: multiple values"; + properties.stateData = 1; + { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.verify(message.suspendedData); + if (error) + return "suspendedData." + error; + } + } + return null; + }; + + /** + * Creates a QueuedResourceState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState} QueuedResourceState + */ + QueuedResourceState.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResourceState(); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "ACCEPTED": + case 2: + message.state = 2; + break; + case "PROVISIONING": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + case "ACTIVE": + case 6: + message.state = 6; + break; + case "SUSPENDING": + case 7: + message.state = 7; + break; + case "SUSPENDED": + case 8: + message.state = 8; + break; + } + if (object.creatingData != null) { + if (typeof object.creatingData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.creatingData: object expected"); + message.creatingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.fromObject(object.creatingData); + } + if (object.acceptedData != null) { + if (typeof object.acceptedData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.acceptedData: object expected"); + message.acceptedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.fromObject(object.acceptedData); + } + if (object.provisioningData != null) { + if (typeof object.provisioningData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.provisioningData: object expected"); + message.provisioningData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.fromObject(object.provisioningData); + } + if (object.failedData != null) { + if (typeof object.failedData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.failedData: object expected"); + message.failedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.fromObject(object.failedData); + } + if (object.deletingData != null) { + if (typeof object.deletingData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.deletingData: object expected"); + message.deletingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.fromObject(object.deletingData); + } + if (object.activeData != null) { + if (typeof object.activeData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.activeData: object expected"); + message.activeData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.fromObject(object.activeData); + } + if (object.suspendingData != null) { + if (typeof object.suspendingData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.suspendingData: object expected"); + message.suspendingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.fromObject(object.suspendingData); + } + if (object.suspendedData != null) { + if (typeof object.suspendedData !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.suspendedData: object expected"); + message.suspendedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.fromObject(object.suspendedData); + } + return message; + }; + + /** + * Creates a plain object from a QueuedResourceState message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState} message QueuedResourceState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueuedResourceState.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.tpu.v2alpha1.QueuedResourceState.State[message.state] === undefined ? message.state : $root.google.cloud.tpu.v2alpha1.QueuedResourceState.State[message.state] : message.state; + if (message.creatingData != null && message.hasOwnProperty("creatingData")) { + object.creatingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.toObject(message.creatingData, options); + if (options.oneofs) + object.stateData = "creatingData"; + } + if (message.acceptedData != null && message.hasOwnProperty("acceptedData")) { + object.acceptedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.toObject(message.acceptedData, options); + if (options.oneofs) + object.stateData = "acceptedData"; + } + if (message.provisioningData != null && message.hasOwnProperty("provisioningData")) { + object.provisioningData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.toObject(message.provisioningData, options); + if (options.oneofs) + object.stateData = "provisioningData"; + } + if (message.failedData != null && message.hasOwnProperty("failedData")) { + object.failedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.toObject(message.failedData, options); + if (options.oneofs) + object.stateData = "failedData"; + } + if (message.deletingData != null && message.hasOwnProperty("deletingData")) { + object.deletingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.toObject(message.deletingData, options); + if (options.oneofs) + object.stateData = "deletingData"; + } + if (message.activeData != null && message.hasOwnProperty("activeData")) { + object.activeData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.toObject(message.activeData, options); + if (options.oneofs) + object.stateData = "activeData"; + } + if (message.suspendingData != null && message.hasOwnProperty("suspendingData")) { + object.suspendingData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.toObject(message.suspendingData, options); + if (options.oneofs) + object.stateData = "suspendingData"; + } + if (message.suspendedData != null && message.hasOwnProperty("suspendedData")) { + object.suspendedData = $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.toObject(message.suspendedData, options); + if (options.oneofs) + object.stateData = "suspendedData"; + } + return object; + }; + + /** + * Converts this QueuedResourceState to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @instance + * @returns {Object.} JSON object + */ + QueuedResourceState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueuedResourceState + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueuedResourceState.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState"; + }; + + /** + * State enum. + * @name google.cloud.tpu.v2alpha1.QueuedResourceState.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} ACCEPTED=2 ACCEPTED value + * @property {number} PROVISIONING=3 PROVISIONING value + * @property {number} FAILED=4 FAILED value + * @property {number} DELETING=5 DELETING value + * @property {number} ACTIVE=6 ACTIVE value + * @property {number} SUSPENDING=7 SUSPENDING value + * @property {number} SUSPENDED=8 SUSPENDED value + */ + QueuedResourceState.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "ACCEPTED"] = 2; + values[valuesById[3] = "PROVISIONING"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "DELETING"] = 5; + values[valuesById[6] = "ACTIVE"] = 6; + values[valuesById[7] = "SUSPENDING"] = 7; + values[valuesById[8] = "SUSPENDED"] = 8; + return values; + })(); + + QueuedResourceState.CreatingData = (function() { + + /** + * Properties of a CreatingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface ICreatingData + */ + + /** + * Constructs a new CreatingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a CreatingData. + * @implements ICreatingData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData=} [properties] Properties to set + */ + function CreatingData(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]]; + } + + /** + * Creates a new CreatingData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData} CreatingData instance + */ + CreatingData.create = function create(properties) { + return new CreatingData(properties); + }; + + /** + * Encodes the specified CreatingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData} message CreatingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatingData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified CreatingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ICreatingData} message CreatingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatingData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreatingData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData} CreatingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatingData.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.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreatingData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData} CreatingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatingData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreatingData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreatingData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a CreatingData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData} CreatingData + */ + CreatingData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData(); + }; + + /** + * Creates a plain object from a CreatingData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData} message CreatingData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreatingData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this CreatingData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @instance + * @returns {Object.} JSON object + */ + CreatingData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreatingData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreatingData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.CreatingData"; + }; + + return CreatingData; + })(); + + QueuedResourceState.AcceptedData = (function() { + + /** + * Properties of an AcceptedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface IAcceptedData + */ + + /** + * Constructs a new AcceptedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents an AcceptedData. + * @implements IAcceptedData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData=} [properties] Properties to set + */ + function AcceptedData(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]]; + } + + /** + * Creates a new AcceptedData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData} AcceptedData instance + */ + AcceptedData.create = function create(properties) { + return new AcceptedData(properties); + }; + + /** + * Encodes the specified AcceptedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData} message AcceptedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceptedData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AcceptedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IAcceptedData} message AcceptedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceptedData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AcceptedData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData} AcceptedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceptedData.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.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AcceptedData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData} AcceptedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceptedData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AcceptedData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AcceptedData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AcceptedData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData} AcceptedData + */ + AcceptedData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData(); + }; + + /** + * Creates a plain object from an AcceptedData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData} message AcceptedData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AcceptedData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AcceptedData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @instance + * @returns {Object.} JSON object + */ + AcceptedData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AcceptedData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AcceptedData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.AcceptedData"; + }; + + return AcceptedData; + })(); + + QueuedResourceState.ProvisioningData = (function() { + + /** + * Properties of a ProvisioningData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface IProvisioningData + */ + + /** + * Constructs a new ProvisioningData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a ProvisioningData. + * @implements IProvisioningData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData=} [properties] Properties to set + */ + function ProvisioningData(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]]; + } + + /** + * Creates a new ProvisioningData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData} ProvisioningData instance + */ + ProvisioningData.create = function create(properties) { + return new ProvisioningData(properties); + }; + + /** + * Encodes the specified ProvisioningData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData} message ProvisioningData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProvisioningData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ProvisioningData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IProvisioningData} message ProvisioningData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProvisioningData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProvisioningData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData} ProvisioningData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProvisioningData.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.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProvisioningData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData} ProvisioningData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProvisioningData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProvisioningData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProvisioningData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a ProvisioningData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData} ProvisioningData + */ + ProvisioningData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData(); + }; + + /** + * Creates a plain object from a ProvisioningData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData} message ProvisioningData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProvisioningData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ProvisioningData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @instance + * @returns {Object.} JSON object + */ + ProvisioningData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ProvisioningData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProvisioningData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.ProvisioningData"; + }; + + return ProvisioningData; + })(); + + QueuedResourceState.FailedData = (function() { + + /** + * Properties of a FailedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface IFailedData + * @property {google.rpc.IStatus|null} [error] FailedData error + */ + + /** + * Constructs a new FailedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a FailedData. + * @implements IFailedData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData=} [properties] Properties to set + */ + function FailedData(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]]; + } + + /** + * FailedData error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @instance + */ + FailedData.prototype.error = null; + + /** + * Creates a new FailedData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData} FailedData instance + */ + FailedData.create = function create(properties) { + return new FailedData(properties); + }; + + /** + * Encodes the specified FailedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData} message FailedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailedData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FailedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IFailedData} message FailedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailedData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FailedData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData} FailedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailedData.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.cloud.tpu.v2alpha1.QueuedResourceState.FailedData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FailedData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData} FailedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailedData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FailedData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FailedData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + return null; + }; + + /** + * Creates a FailedData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData} FailedData + */ + FailedData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData(); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + return message; + }; + + /** + * Creates a plain object from a FailedData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData} message FailedData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FailedData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.error = null; + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + return object; + }; + + /** + * Converts this FailedData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @instance + * @returns {Object.} JSON object + */ + FailedData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FailedData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FailedData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.FailedData"; + }; + + return FailedData; + })(); + + QueuedResourceState.DeletingData = (function() { + + /** + * Properties of a DeletingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface IDeletingData + */ + + /** + * Constructs a new DeletingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a DeletingData. + * @implements IDeletingData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData=} [properties] Properties to set + */ + function DeletingData(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]]; + } + + /** + * Creates a new DeletingData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData} DeletingData instance + */ + DeletingData.create = function create(properties) { + return new DeletingData(properties); + }; + + /** + * Encodes the specified DeletingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData} message DeletingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletingData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeletingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IDeletingData} message DeletingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletingData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeletingData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData} DeletingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletingData.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.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeletingData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData} DeletingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletingData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeletingData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeletingData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeletingData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData} DeletingData + */ + DeletingData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData(); + }; + + /** + * Creates a plain object from a DeletingData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData} message DeletingData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeletingData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeletingData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @instance + * @returns {Object.} JSON object + */ + DeletingData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeletingData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeletingData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.DeletingData"; + }; + + return DeletingData; + })(); + + QueuedResourceState.ActiveData = (function() { + + /** + * Properties of an ActiveData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface IActiveData + */ + + /** + * Constructs a new ActiveData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents an ActiveData. + * @implements IActiveData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData=} [properties] Properties to set + */ + function ActiveData(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]]; + } + + /** + * Creates a new ActiveData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData} ActiveData instance + */ + ActiveData.create = function create(properties) { + return new ActiveData(properties); + }; + + /** + * Encodes the specified ActiveData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData} message ActiveData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActiveData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ActiveData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.IActiveData} message ActiveData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActiveData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ActiveData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData} ActiveData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActiveData.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.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ActiveData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData} ActiveData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActiveData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ActiveData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ActiveData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an ActiveData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData} ActiveData + */ + ActiveData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData(); + }; + + /** + * Creates a plain object from an ActiveData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData} message ActiveData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ActiveData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ActiveData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @instance + * @returns {Object.} JSON object + */ + ActiveData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ActiveData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ActiveData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.ActiveData"; + }; + + return ActiveData; + })(); + + QueuedResourceState.SuspendingData = (function() { + + /** + * Properties of a SuspendingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface ISuspendingData + */ + + /** + * Constructs a new SuspendingData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a SuspendingData. + * @implements ISuspendingData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData=} [properties] Properties to set + */ + function SuspendingData(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]]; + } + + /** + * Creates a new SuspendingData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData} SuspendingData instance + */ + SuspendingData.create = function create(properties) { + return new SuspendingData(properties); + }; + + /** + * Encodes the specified SuspendingData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData} message SuspendingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuspendingData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SuspendingData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendingData} message SuspendingData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuspendingData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuspendingData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData} SuspendingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuspendingData.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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuspendingData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData} SuspendingData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuspendingData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuspendingData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuspendingData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SuspendingData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData} SuspendingData + */ + SuspendingData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData(); + }; + + /** + * Creates a plain object from a SuspendingData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData} message SuspendingData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuspendingData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SuspendingData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @instance + * @returns {Object.} JSON object + */ + SuspendingData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuspendingData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuspendingData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendingData"; + }; + + return SuspendingData; + })(); + + QueuedResourceState.SuspendedData = (function() { + + /** + * Properties of a SuspendedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @interface ISuspendedData + */ + + /** + * Constructs a new SuspendedData. + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState + * @classdesc Represents a SuspendedData. + * @implements ISuspendedData + * @constructor + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData=} [properties] Properties to set + */ + function SuspendedData(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]]; + } + + /** + * Creates a new SuspendedData instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData} SuspendedData instance + */ + SuspendedData.create = function create(properties) { + return new SuspendedData(properties); + }; + + /** + * Encodes the specified SuspendedData message. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData} message SuspendedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuspendedData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SuspendedData message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.ISuspendedData} message SuspendedData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuspendedData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuspendedData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData} SuspendedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuspendedData.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.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuspendedData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData} SuspendedData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuspendedData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuspendedData message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuspendedData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SuspendedData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData} SuspendedData + */ + SuspendedData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData) + return object; + return new $root.google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData(); + }; + + /** + * Creates a plain object from a SuspendedData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData} message SuspendedData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuspendedData.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SuspendedData to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @instance + * @returns {Object.} JSON object + */ + SuspendedData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuspendedData + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuspendedData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.QueuedResourceState.SuspendedData"; + }; + + return SuspendedData; + })(); + + return QueuedResourceState; + })(); + + v2alpha1.ListNodesRequest = (function() { + + /** + * Properties of a ListNodesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListNodesRequest + * @property {string|null} [parent] ListNodesRequest parent + * @property {number|null} [pageSize] ListNodesRequest pageSize + * @property {string|null} [pageToken] ListNodesRequest pageToken + */ + + /** + * Constructs a new ListNodesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListNodesRequest. + * @implements IListNodesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set + */ + function ListNodesRequest(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]]; + } + + /** + * ListNodesRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.parent = ""; + + /** + * ListNodesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.pageSize = 0; + + /** + * ListNodesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + */ + ListNodesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListNodesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest instance + */ + ListNodesRequest.create = function create(properties) { + return new ListNodesRequest(properties); + }; + + /** + * Encodes the specified ListNodesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListNodesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesRequest} message ListNodesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesRequest.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.cloud.tpu.v2alpha1.ListNodesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNodesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNodesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNodesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListNodesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListNodesRequest} ListNodesRequest + */ + ListNodesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListNodesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListNodesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListNodesRequest} message ListNodesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNodesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListNodesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @instance + * @returns {Object.} JSON object + */ + ListNodesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNodesRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListNodesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNodesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListNodesRequest"; + }; + + return ListNodesRequest; + })(); + + v2alpha1.ListNodesResponse = (function() { + + /** + * Properties of a ListNodesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListNodesResponse + * @property {Array.|null} [nodes] ListNodesResponse nodes + * @property {string|null} [nextPageToken] ListNodesResponse nextPageToken + * @property {Array.|null} [unreachable] ListNodesResponse unreachable + */ + + /** + * Constructs a new ListNodesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListNodesResponse. + * @implements IListNodesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set + */ + function ListNodesResponse(properties) { + this.nodes = []; + this.unreachable = []; + 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]]; + } + + /** + * ListNodesResponse nodes. + * @member {Array.} nodes + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.nodes = $util.emptyArray; + + /** + * ListNodesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.nextPageToken = ""; + + /** + * ListNodesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + */ + ListNodesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListNodesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse instance + */ + ListNodesResponse.create = function create(properties) { + return new ListNodesResponse(properties); + }; + + /** + * Encodes the specified ListNodesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.nodes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListNodesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListNodesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListNodesResponse} message ListNodesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNodesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesResponse.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.cloud.tpu.v2alpha1.ListNodesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNodesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNodesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNodesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNodesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListNodesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListNodesResponse} ListNodesResponse + */ + ListNodesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListNodesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListNodesResponse(); + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.nodes: object expected"); + message.nodes[i] = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.nodes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListNodesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListNodesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListNodesResponse} message ListNodesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNodesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.nodes = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.nodes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListNodesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @instance + * @returns {Object.} JSON object + */ + ListNodesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNodesResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListNodesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNodesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListNodesResponse"; + }; + + return ListNodesResponse; + })(); + + v2alpha1.GetNodeRequest = (function() { + + /** + * Properties of a GetNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetNodeRequest + * @property {string|null} [name] GetNodeRequest name + */ + + /** + * Constructs a new GetNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetNodeRequest. + * @implements IGetNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set + */ + function GetNodeRequest(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]]; + } + + /** + * GetNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @instance + */ + GetNodeRequest.prototype.name = ""; + + /** + * Creates a new GetNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest instance + */ + GetNodeRequest.create = function create(properties) { + return new GetNodeRequest(properties); + }; + + /** + * Encodes the specified GetNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetNodeRequest} message GetNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeRequest.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.cloud.tpu.v2alpha1.GetNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetNodeRequest} GetNodeRequest + */ + GetNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetNodeRequest} message GetNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @instance + * @returns {Object.} JSON object + */ + GetNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GetNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetNodeRequest"; + }; + + return GetNodeRequest; + })(); + + v2alpha1.CreateNodeRequest = (function() { + + /** + * Properties of a CreateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ICreateNodeRequest + * @property {string|null} [parent] CreateNodeRequest parent + * @property {string|null} [nodeId] CreateNodeRequest nodeId + * @property {google.cloud.tpu.v2alpha1.INode|null} [node] CreateNodeRequest node + * @property {string|null} [requestId] CreateNodeRequest requestId + */ + + /** + * Constructs a new CreateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a CreateNodeRequest. + * @implements ICreateNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set + */ + function CreateNodeRequest(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]]; + } + + /** + * CreateNodeRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.parent = ""; + + /** + * CreateNodeRequest nodeId. + * @member {string} nodeId + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.nodeId = ""; + + /** + * CreateNodeRequest node. + * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.node = null; + + /** + * CreateNodeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + */ + CreateNodeRequest.prototype.requestId = ""; + + /** + * Creates a new CreateNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest instance + */ + CreateNodeRequest.create = function create(properties) { + return new CreateNodeRequest(properties); + }; + + /** + * Encodes the specified CreateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.nodeId != null && Object.hasOwnProperty.call(message, "nodeId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nodeId); + if (message.node != null && Object.hasOwnProperty.call(message, "node")) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified CreateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateNodeRequest} message CreateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNodeRequest.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.cloud.tpu.v2alpha1.CreateNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.nodeId = reader.string(); + break; + } + case 3: { + message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + break; + } + case 6: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + if (!$util.isString(message.nodeId)) + return "nodeId: string expected"; + if (message.node != null && message.hasOwnProperty("node")) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + if (error) + return "node." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.CreateNodeRequest} CreateNodeRequest + */ + CreateNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.CreateNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.CreateNodeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.nodeId != null) + message.nodeId = String(object.nodeId); + if (object.node != null) { + if (typeof object.node !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.CreateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.CreateNodeRequest} message CreateNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.nodeId = ""; + object.node = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.nodeId != null && message.hasOwnProperty("nodeId")) + object.nodeId = message.nodeId; + if (message.node != null && message.hasOwnProperty("node")) + object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.CreateNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.CreateNodeRequest"; + }; + + return CreateNodeRequest; + })(); + + v2alpha1.DeleteNodeRequest = (function() { + + /** + * Properties of a DeleteNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IDeleteNodeRequest + * @property {string|null} [name] DeleteNodeRequest name + * @property {string|null} [requestId] DeleteNodeRequest requestId + */ + + /** + * Constructs a new DeleteNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a DeleteNodeRequest. + * @implements IDeleteNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set + */ + function DeleteNodeRequest(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]]; + } + + /** + * DeleteNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @instance + */ + DeleteNodeRequest.prototype.name = ""; + + /** + * DeleteNodeRequest requestId. + * @member {string} requestId + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @instance + */ + DeleteNodeRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest instance + */ + DeleteNodeRequest.create = function create(properties) { + return new DeleteNodeRequest(properties); + }; + + /** + * Encodes the specified DeleteNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified DeleteNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteNodeRequest} message DeleteNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNodeRequest.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.cloud.tpu.v2alpha1.DeleteNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a DeleteNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.DeleteNodeRequest} DeleteNodeRequest + */ + DeleteNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.DeleteNodeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a DeleteNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.DeleteNodeRequest} message DeleteNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.requestId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this DeleteNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.DeleteNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.DeleteNodeRequest"; + }; + + return DeleteNodeRequest; + })(); + + v2alpha1.StopNodeRequest = (function() { + + /** + * Properties of a StopNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IStopNodeRequest + * @property {string|null} [name] StopNodeRequest name + */ + + /** + * Constructs a new StopNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a StopNodeRequest. + * @implements IStopNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set + */ + function StopNodeRequest(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]]; + } + + /** + * StopNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @instance + */ + StopNodeRequest.prototype.name = ""; + + /** + * Creates a new StopNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest instance + */ + StopNodeRequest.create = function create(properties) { + return new StopNodeRequest(properties); + }; + + /** + * Encodes the specified StopNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StopNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified StopNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StopNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStopNodeRequest} message StopNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StopNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StopNodeRequest.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.cloud.tpu.v2alpha1.StopNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StopNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StopNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StopNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StopNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a StopNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.StopNodeRequest} StopNodeRequest + */ + StopNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.StopNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.StopNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a StopNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.StopNodeRequest} message StopNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StopNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this StopNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @instance + * @returns {Object.} JSON object + */ + StopNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StopNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.StopNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StopNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.StopNodeRequest"; + }; + + return StopNodeRequest; + })(); + + v2alpha1.StartNodeRequest = (function() { + + /** + * Properties of a StartNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IStartNodeRequest + * @property {string|null} [name] StartNodeRequest name + */ + + /** + * Constructs a new StartNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a StartNodeRequest. + * @implements IStartNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set + */ + function StartNodeRequest(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]]; + } + + /** + * StartNodeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @instance + */ + StartNodeRequest.prototype.name = ""; + + /** + * Creates a new StartNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest instance + */ + StartNodeRequest.create = function create(properties) { + return new StartNodeRequest(properties); + }; + + /** + * Encodes the specified StartNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified StartNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.StartNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IStartNodeRequest} message StartNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StartNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartNodeRequest.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.cloud.tpu.v2alpha1.StartNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StartNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StartNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StartNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StartNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a StartNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.StartNodeRequest} StartNodeRequest + */ + StartNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.StartNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.StartNodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a StartNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.StartNodeRequest} message StartNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StartNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this StartNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @instance + * @returns {Object.} JSON object + */ + StartNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StartNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.StartNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StartNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.StartNodeRequest"; + }; + + return StartNodeRequest; + })(); + + v2alpha1.UpdateNodeRequest = (function() { + + /** + * Properties of an UpdateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IUpdateNodeRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateNodeRequest updateMask + * @property {google.cloud.tpu.v2alpha1.INode|null} [node] UpdateNodeRequest node + */ + + /** + * Constructs a new UpdateNodeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an UpdateNodeRequest. + * @implements IUpdateNodeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set + */ + function UpdateNodeRequest(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]]; + } + + /** + * UpdateNodeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + */ + UpdateNodeRequest.prototype.updateMask = null; + + /** + * UpdateNodeRequest node. + * @member {google.cloud.tpu.v2alpha1.INode|null|undefined} node + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + */ + UpdateNodeRequest.prototype.node = null; + + /** + * Creates a new UpdateNodeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest instance + */ + UpdateNodeRequest.create = function create(properties) { + return new UpdateNodeRequest(properties); + }; + + /** + * Encodes the specified UpdateNodeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.node != null && Object.hasOwnProperty.call(message, "node")) + $root.google.cloud.tpu.v2alpha1.Node.encode(message.node, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateNodeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.UpdateNodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IUpdateNodeRequest} message UpdateNodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNodeRequest.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.cloud.tpu.v2alpha1.UpdateNodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 2: { + message.node = $root.google.cloud.tpu.v2alpha1.Node.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateNodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateNodeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateNodeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.node != null && message.hasOwnProperty("node")) { + var error = $root.google.cloud.tpu.v2alpha1.Node.verify(message.node); + if (error) + return "node." + error; + } + return null; + }; + + /** + * Creates an UpdateNodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.UpdateNodeRequest} UpdateNodeRequest + */ + UpdateNodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.UpdateNodeRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.node != null) { + if (typeof object.node !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.UpdateNodeRequest.node: object expected"); + message.node = $root.google.cloud.tpu.v2alpha1.Node.fromObject(object.node); + } + return message; + }; + + /** + * Creates a plain object from an UpdateNodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.UpdateNodeRequest} message UpdateNodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateNodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.node = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.node != null && message.hasOwnProperty("node")) + object.node = $root.google.cloud.tpu.v2alpha1.Node.toObject(message.node, options); + return object; + }; + + /** + * Converts this UpdateNodeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateNodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateNodeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.UpdateNodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateNodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.UpdateNodeRequest"; + }; + + return UpdateNodeRequest; + })(); + + v2alpha1.ListQueuedResourcesRequest = (function() { + + /** + * Properties of a ListQueuedResourcesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListQueuedResourcesRequest + * @property {string|null} [parent] ListQueuedResourcesRequest parent + * @property {number|null} [pageSize] ListQueuedResourcesRequest pageSize + * @property {string|null} [pageToken] ListQueuedResourcesRequest pageToken + */ + + /** + * Constructs a new ListQueuedResourcesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListQueuedResourcesRequest. + * @implements IListQueuedResourcesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest=} [properties] Properties to set + */ + function ListQueuedResourcesRequest(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]]; + } + + /** + * ListQueuedResourcesRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @instance + */ + ListQueuedResourcesRequest.prototype.parent = ""; + + /** + * ListQueuedResourcesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @instance + */ + ListQueuedResourcesRequest.prototype.pageSize = 0; + + /** + * ListQueuedResourcesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @instance + */ + ListQueuedResourcesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListQueuedResourcesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest} ListQueuedResourcesRequest instance + */ + ListQueuedResourcesRequest.create = function create(properties) { + return new ListQueuedResourcesRequest(properties); + }; + + /** + * Encodes the specified ListQueuedResourcesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest} message ListQueuedResourcesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQueuedResourcesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListQueuedResourcesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest} message ListQueuedResourcesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQueuedResourcesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQueuedResourcesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest} ListQueuedResourcesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQueuedResourcesRequest.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.cloud.tpu.v2alpha1.ListQueuedResourcesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListQueuedResourcesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest} ListQueuedResourcesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQueuedResourcesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQueuedResourcesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQueuedResourcesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListQueuedResourcesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest} ListQueuedResourcesRequest + */ + ListQueuedResourcesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListQueuedResourcesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest} message ListQueuedResourcesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQueuedResourcesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListQueuedResourcesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @instance + * @returns {Object.} JSON object + */ + ListQueuedResourcesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQueuedResourcesRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQueuedResourcesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest"; + }; + + return ListQueuedResourcesRequest; + })(); + + v2alpha1.ListQueuedResourcesResponse = (function() { + + /** + * Properties of a ListQueuedResourcesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListQueuedResourcesResponse + * @property {Array.|null} [queuedResources] ListQueuedResourcesResponse queuedResources + * @property {string|null} [nextPageToken] ListQueuedResourcesResponse nextPageToken + * @property {Array.|null} [unreachable] ListQueuedResourcesResponse unreachable + */ + + /** + * Constructs a new ListQueuedResourcesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListQueuedResourcesResponse. + * @implements IListQueuedResourcesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse=} [properties] Properties to set + */ + function ListQueuedResourcesResponse(properties) { + this.queuedResources = []; + this.unreachable = []; + 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]]; + } + + /** + * ListQueuedResourcesResponse queuedResources. + * @member {Array.} queuedResources + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @instance + */ + ListQueuedResourcesResponse.prototype.queuedResources = $util.emptyArray; + + /** + * ListQueuedResourcesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @instance + */ + ListQueuedResourcesResponse.prototype.nextPageToken = ""; + + /** + * ListQueuedResourcesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @instance + */ + ListQueuedResourcesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListQueuedResourcesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} ListQueuedResourcesResponse instance + */ + ListQueuedResourcesResponse.create = function create(properties) { + return new ListQueuedResourcesResponse(properties); + }; + + /** + * Encodes the specified ListQueuedResourcesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse} message ListQueuedResourcesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQueuedResourcesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queuedResources != null && message.queuedResources.length) + for (var i = 0; i < message.queuedResources.length; ++i) + $root.google.cloud.tpu.v2alpha1.QueuedResource.encode(message.queuedResources[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListQueuedResourcesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse} message ListQueuedResourcesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQueuedResourcesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQueuedResourcesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} ListQueuedResourcesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQueuedResourcesResponse.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.cloud.tpu.v2alpha1.ListQueuedResourcesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.queuedResources && message.queuedResources.length)) + message.queuedResources = []; + message.queuedResources.push($root.google.cloud.tpu.v2alpha1.QueuedResource.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListQueuedResourcesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} ListQueuedResourcesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQueuedResourcesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQueuedResourcesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQueuedResourcesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queuedResources != null && message.hasOwnProperty("queuedResources")) { + if (!Array.isArray(message.queuedResources)) + return "queuedResources: array expected"; + for (var i = 0; i < message.queuedResources.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.verify(message.queuedResources[i]); + if (error) + return "queuedResources." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListQueuedResourcesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} ListQueuedResourcesResponse + */ + ListQueuedResourcesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse(); + if (object.queuedResources) { + if (!Array.isArray(object.queuedResources)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.queuedResources: array expected"); + message.queuedResources = []; + for (var i = 0; i < object.queuedResources.length; ++i) { + if (typeof object.queuedResources[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.queuedResources: object expected"); + message.queuedResources[i] = $root.google.cloud.tpu.v2alpha1.QueuedResource.fromObject(object.queuedResources[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListQueuedResourcesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse} message ListQueuedResourcesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQueuedResourcesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.queuedResources = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.queuedResources && message.queuedResources.length) { + object.queuedResources = []; + for (var j = 0; j < message.queuedResources.length; ++j) + object.queuedResources[j] = $root.google.cloud.tpu.v2alpha1.QueuedResource.toObject(message.queuedResources[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListQueuedResourcesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @instance + * @returns {Object.} JSON object + */ + ListQueuedResourcesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQueuedResourcesResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQueuedResourcesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse"; + }; + + return ListQueuedResourcesResponse; + })(); + + v2alpha1.GetQueuedResourceRequest = (function() { + + /** + * Properties of a GetQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetQueuedResourceRequest + * @property {string|null} [name] GetQueuedResourceRequest name + */ + + /** + * Constructs a new GetQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetQueuedResourceRequest. + * @implements IGetQueuedResourceRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest=} [properties] Properties to set + */ + function GetQueuedResourceRequest(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]]; + } + + /** + * GetQueuedResourceRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @instance + */ + GetQueuedResourceRequest.prototype.name = ""; + + /** + * Creates a new GetQueuedResourceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetQueuedResourceRequest} GetQueuedResourceRequest instance + */ + GetQueuedResourceRequest.create = function create(properties) { + return new GetQueuedResourceRequest(properties); + }; + + /** + * Encodes the specified GetQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetQueuedResourceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest} message GetQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQueuedResourceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetQueuedResourceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest} message GetQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQueuedResourceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetQueuedResourceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetQueuedResourceRequest} GetQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQueuedResourceRequest.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.cloud.tpu.v2alpha1.GetQueuedResourceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetQueuedResourceRequest} GetQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQueuedResourceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetQueuedResourceRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetQueuedResourceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetQueuedResourceRequest} GetQueuedResourceRequest + */ + GetQueuedResourceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetQueuedResourceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetQueuedResourceRequest} message GetQueuedResourceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetQueuedResourceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetQueuedResourceRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @instance + * @returns {Object.} JSON object + */ + GetQueuedResourceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetQueuedResourceRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GetQueuedResourceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetQueuedResourceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetQueuedResourceRequest"; + }; + + return GetQueuedResourceRequest; + })(); + + v2alpha1.CreateQueuedResourceRequest = (function() { + + /** + * Properties of a CreateQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ICreateQueuedResourceRequest + * @property {string|null} [parent] CreateQueuedResourceRequest parent + * @property {string|null} [queuedResourceId] CreateQueuedResourceRequest queuedResourceId + * @property {google.cloud.tpu.v2alpha1.IQueuedResource|null} [queuedResource] CreateQueuedResourceRequest queuedResource + * @property {string|null} [requestId] CreateQueuedResourceRequest requestId + */ + + /** + * Constructs a new CreateQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a CreateQueuedResourceRequest. + * @implements ICreateQueuedResourceRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest=} [properties] Properties to set + */ + function CreateQueuedResourceRequest(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]]; + } + + /** + * CreateQueuedResourceRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @instance + */ + CreateQueuedResourceRequest.prototype.parent = ""; + + /** + * CreateQueuedResourceRequest queuedResourceId. + * @member {string} queuedResourceId + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @instance + */ + CreateQueuedResourceRequest.prototype.queuedResourceId = ""; + + /** + * CreateQueuedResourceRequest queuedResource. + * @member {google.cloud.tpu.v2alpha1.IQueuedResource|null|undefined} queuedResource + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @instance + */ + CreateQueuedResourceRequest.prototype.queuedResource = null; + + /** + * CreateQueuedResourceRequest requestId. + * @member {string} requestId + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @instance + */ + CreateQueuedResourceRequest.prototype.requestId = ""; + + /** + * Creates a new CreateQueuedResourceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest} CreateQueuedResourceRequest instance + */ + CreateQueuedResourceRequest.create = function create(properties) { + return new CreateQueuedResourceRequest(properties); + }; + + /** + * Encodes the specified CreateQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest} message CreateQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateQueuedResourceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.queuedResourceId != null && Object.hasOwnProperty.call(message, "queuedResourceId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.queuedResourceId); + if (message.queuedResource != null && Object.hasOwnProperty.call(message, "queuedResource")) + $root.google.cloud.tpu.v2alpha1.QueuedResource.encode(message.queuedResource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified CreateQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest} message CreateQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateQueuedResourceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateQueuedResourceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest} CreateQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateQueuedResourceRequest.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.cloud.tpu.v2alpha1.CreateQueuedResourceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.queuedResourceId = reader.string(); + break; + } + case 3: { + message.queuedResource = $root.google.cloud.tpu.v2alpha1.QueuedResource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest} CreateQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateQueuedResourceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateQueuedResourceRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateQueuedResourceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.queuedResourceId != null && message.hasOwnProperty("queuedResourceId")) + if (!$util.isString(message.queuedResourceId)) + return "queuedResourceId: string expected"; + if (message.queuedResource != null && message.hasOwnProperty("queuedResource")) { + var error = $root.google.cloud.tpu.v2alpha1.QueuedResource.verify(message.queuedResource); + if (error) + return "queuedResource." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a CreateQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest} CreateQueuedResourceRequest + */ + CreateQueuedResourceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.queuedResourceId != null) + message.queuedResourceId = String(object.queuedResourceId); + if (object.queuedResource != null) { + if (typeof object.queuedResource !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest.queuedResource: object expected"); + message.queuedResource = $root.google.cloud.tpu.v2alpha1.QueuedResource.fromObject(object.queuedResource); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a CreateQueuedResourceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest} message CreateQueuedResourceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateQueuedResourceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.queuedResourceId = ""; + object.queuedResource = null; + object.requestId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.queuedResourceId != null && message.hasOwnProperty("queuedResourceId")) + object.queuedResourceId = message.queuedResourceId; + if (message.queuedResource != null && message.hasOwnProperty("queuedResource")) + object.queuedResource = $root.google.cloud.tpu.v2alpha1.QueuedResource.toObject(message.queuedResource, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this CreateQueuedResourceRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @instance + * @returns {Object.} JSON object + */ + CreateQueuedResourceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateQueuedResourceRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateQueuedResourceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest"; + }; + + return CreateQueuedResourceRequest; + })(); + + v2alpha1.DeleteQueuedResourceRequest = (function() { + + /** + * Properties of a DeleteQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IDeleteQueuedResourceRequest + * @property {string|null} [name] DeleteQueuedResourceRequest name + * @property {string|null} [requestId] DeleteQueuedResourceRequest requestId + */ + + /** + * Constructs a new DeleteQueuedResourceRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a DeleteQueuedResourceRequest. + * @implements IDeleteQueuedResourceRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest=} [properties] Properties to set + */ + function DeleteQueuedResourceRequest(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]]; + } + + /** + * DeleteQueuedResourceRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @instance + */ + DeleteQueuedResourceRequest.prototype.name = ""; + + /** + * DeleteQueuedResourceRequest requestId. + * @member {string} requestId + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @instance + */ + DeleteQueuedResourceRequest.prototype.requestId = ""; + + /** + * Creates a new DeleteQueuedResourceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest} DeleteQueuedResourceRequest instance + */ + DeleteQueuedResourceRequest.create = function create(properties) { + return new DeleteQueuedResourceRequest(properties); + }; + + /** + * Encodes the specified DeleteQueuedResourceRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest} message DeleteQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteQueuedResourceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.requestId); + return writer; + }; + + /** + * Encodes the specified DeleteQueuedResourceRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest} message DeleteQueuedResourceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteQueuedResourceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteQueuedResourceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest} DeleteQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteQueuedResourceRequest.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.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteQueuedResourceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest} DeleteQueuedResourceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteQueuedResourceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteQueuedResourceRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteQueuedResourceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates a DeleteQueuedResourceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest} DeleteQueuedResourceRequest + */ + DeleteQueuedResourceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from a DeleteQueuedResourceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest} message DeleteQueuedResourceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteQueuedResourceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.requestId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + return object; + }; + + /** + * Converts this DeleteQueuedResourceRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteQueuedResourceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteQueuedResourceRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteQueuedResourceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest"; + }; + + return DeleteQueuedResourceRequest; + })(); + + v2alpha1.ServiceIdentity = (function() { + + /** + * Properties of a ServiceIdentity. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IServiceIdentity + * @property {string|null} [email] ServiceIdentity email + */ + + /** + * Constructs a new ServiceIdentity. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ServiceIdentity. + * @implements IServiceIdentity + * @constructor + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set + */ + function ServiceIdentity(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]]; + } + + /** + * ServiceIdentity email. + * @member {string} email + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @instance + */ + ServiceIdentity.prototype.email = ""; + + /** + * Creates a new ServiceIdentity instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity instance + */ + ServiceIdentity.create = function create(properties) { + return new ServiceIdentity(properties); + }; + + /** + * Encodes the specified ServiceIdentity message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.email != null && Object.hasOwnProperty.call(message, "email")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.email); + return writer; + }; + + /** + * Encodes the specified ServiceIdentity message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ServiceIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.IServiceIdentity} message ServiceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceIdentity.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.cloud.tpu.v2alpha1.ServiceIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.email = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceIdentity message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.email != null && message.hasOwnProperty("email")) + if (!$util.isString(message.email)) + return "email: string expected"; + return null; + }; + + /** + * Creates a ServiceIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ServiceIdentity} ServiceIdentity + */ + ServiceIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ServiceIdentity) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ServiceIdentity(); + if (object.email != null) + message.email = String(object.email); + return message; + }; + + /** + * Creates a plain object from a ServiceIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {google.cloud.tpu.v2alpha1.ServiceIdentity} message ServiceIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.email = ""; + if (message.email != null && message.hasOwnProperty("email")) + object.email = message.email; + return object; + }; + + /** + * Converts this ServiceIdentity to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @instance + * @returns {Object.} JSON object + */ + ServiceIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceIdentity + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ServiceIdentity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ServiceIdentity"; + }; + + return ServiceIdentity; + })(); + + v2alpha1.GenerateServiceIdentityRequest = (function() { + + /** + * Properties of a GenerateServiceIdentityRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGenerateServiceIdentityRequest + * @property {string|null} [parent] GenerateServiceIdentityRequest parent + */ + + /** + * Constructs a new GenerateServiceIdentityRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GenerateServiceIdentityRequest. + * @implements IGenerateServiceIdentityRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set + */ + function GenerateServiceIdentityRequest(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]]; + } + + /** + * GenerateServiceIdentityRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @instance + */ + GenerateServiceIdentityRequest.prototype.parent = ""; + + /** + * Creates a new GenerateServiceIdentityRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest instance + */ + GenerateServiceIdentityRequest.create = function create(properties) { + return new GenerateServiceIdentityRequest(properties); + }; + + /** + * Encodes the specified GenerateServiceIdentityRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateServiceIdentityRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityRequest} message GenerateServiceIdentityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityRequest.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.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateServiceIdentityRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateServiceIdentityRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateServiceIdentityRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateServiceIdentityRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} GenerateServiceIdentityRequest + */ + GenerateServiceIdentityRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateServiceIdentityRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest} message GenerateServiceIdentityRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateServiceIdentityRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateServiceIdentityRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateServiceIdentityRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateServiceIdentityRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateServiceIdentityRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GenerateServiceIdentityRequest"; + }; + + return GenerateServiceIdentityRequest; + })(); + + v2alpha1.GenerateServiceIdentityResponse = (function() { + + /** + * Properties of a GenerateServiceIdentityResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGenerateServiceIdentityResponse + * @property {google.cloud.tpu.v2alpha1.IServiceIdentity|null} [identity] GenerateServiceIdentityResponse identity + */ + + /** + * Constructs a new GenerateServiceIdentityResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GenerateServiceIdentityResponse. + * @implements IGenerateServiceIdentityResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set + */ + function GenerateServiceIdentityResponse(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]]; + } + + /** + * GenerateServiceIdentityResponse identity. + * @member {google.cloud.tpu.v2alpha1.IServiceIdentity|null|undefined} identity + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @instance + */ + GenerateServiceIdentityResponse.prototype.identity = null; + + /** + * Creates a new GenerateServiceIdentityResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse instance + */ + GenerateServiceIdentityResponse.create = function create(properties) { + return new GenerateServiceIdentityResponse(properties); + }; + + /** + * Encodes the specified GenerateServiceIdentityResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + $root.google.cloud.tpu.v2alpha1.ServiceIdentity.encode(message.identity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateServiceIdentityResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGenerateServiceIdentityResponse} message GenerateServiceIdentityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateServiceIdentityResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityResponse.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.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateServiceIdentityResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateServiceIdentityResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateServiceIdentityResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateServiceIdentityResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identity != null && message.hasOwnProperty("identity")) { + var error = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.verify(message.identity); + if (error) + return "identity." + error; + } + return null; + }; + + /** + * Creates a GenerateServiceIdentityResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} GenerateServiceIdentityResponse + */ + GenerateServiceIdentityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse(); + if (object.identity != null) { + if (typeof object.identity !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse.identity: object expected"); + message.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.fromObject(object.identity); + } + return message; + }; + + /** + * Creates a plain object from a GenerateServiceIdentityResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse} message GenerateServiceIdentityResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateServiceIdentityResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.identity = null; + if (message.identity != null && message.hasOwnProperty("identity")) + object.identity = $root.google.cloud.tpu.v2alpha1.ServiceIdentity.toObject(message.identity, options); + return object; + }; + + /** + * Converts this GenerateServiceIdentityResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateServiceIdentityResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateServiceIdentityResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateServiceIdentityResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GenerateServiceIdentityResponse"; + }; + + return GenerateServiceIdentityResponse; + })(); + + v2alpha1.AcceleratorType = (function() { + + /** + * Properties of an AcceleratorType. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IAcceleratorType + * @property {string|null} [name] AcceleratorType name + * @property {string|null} [type] AcceleratorType type + */ + + /** + * Constructs a new AcceleratorType. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an AcceleratorType. + * @implements IAcceleratorType + * @constructor + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set + */ + function AcceleratorType(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]]; + } + + /** + * AcceleratorType name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + */ + AcceleratorType.prototype.name = ""; + + /** + * AcceleratorType type. + * @member {string} type + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + */ + AcceleratorType.prototype.type = ""; + + /** + * Creates a new AcceleratorType instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType instance + */ + AcceleratorType.create = function create(properties) { + return new AcceleratorType(properties); + }; + + /** + * Encodes the specified AcceleratorType message. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceleratorType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + return writer; + }; + + /** + * Encodes the specified AcceleratorType message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.AcceleratorType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.IAcceleratorType} message AcceleratorType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcceleratorType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceleratorType.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.cloud.tpu.v2alpha1.AcceleratorType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AcceleratorType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcceleratorType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AcceleratorType message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AcceleratorType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + return null; + }; + + /** + * Creates an AcceleratorType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.AcceleratorType} AcceleratorType + */ + AcceleratorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.AcceleratorType) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.AcceleratorType(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + return message; + }; + + /** + * Creates a plain object from an AcceleratorType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {google.cloud.tpu.v2alpha1.AcceleratorType} message AcceleratorType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AcceleratorType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.type = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this AcceleratorType to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @instance + * @returns {Object.} JSON object + */ + AcceleratorType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AcceleratorType + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.AcceleratorType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AcceleratorType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.AcceleratorType"; + }; + + return AcceleratorType; + })(); + + v2alpha1.GetAcceleratorTypeRequest = (function() { + + /** + * Properties of a GetAcceleratorTypeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetAcceleratorTypeRequest + * @property {string|null} [name] GetAcceleratorTypeRequest name + */ + + /** + * Constructs a new GetAcceleratorTypeRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetAcceleratorTypeRequest. + * @implements IGetAcceleratorTypeRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set + */ + function GetAcceleratorTypeRequest(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]]; + } + + /** + * GetAcceleratorTypeRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @instance + */ + GetAcceleratorTypeRequest.prototype.name = ""; + + /** + * Creates a new GetAcceleratorTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest instance + */ + GetAcceleratorTypeRequest.create = function create(properties) { + return new GetAcceleratorTypeRequest(properties); + }; + + /** + * Encodes the specified GetAcceleratorTypeRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAcceleratorTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetAcceleratorTypeRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetAcceleratorTypeRequest} message GetAcceleratorTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAcceleratorTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAcceleratorTypeRequest.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.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAcceleratorTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAcceleratorTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAcceleratorTypeRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAcceleratorTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetAcceleratorTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} GetAcceleratorTypeRequest + */ + GetAcceleratorTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAcceleratorTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest} message GetAcceleratorTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAcceleratorTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetAcceleratorTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetAcceleratorTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetAcceleratorTypeRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAcceleratorTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetAcceleratorTypeRequest"; + }; + + return GetAcceleratorTypeRequest; + })(); + + v2alpha1.ListAcceleratorTypesRequest = (function() { + + /** + * Properties of a ListAcceleratorTypesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListAcceleratorTypesRequest + * @property {string|null} [parent] ListAcceleratorTypesRequest parent + * @property {number|null} [pageSize] ListAcceleratorTypesRequest pageSize + * @property {string|null} [pageToken] ListAcceleratorTypesRequest pageToken + * @property {string|null} [filter] ListAcceleratorTypesRequest filter + * @property {string|null} [orderBy] ListAcceleratorTypesRequest orderBy + */ + + /** + * Constructs a new ListAcceleratorTypesRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListAcceleratorTypesRequest. + * @implements IListAcceleratorTypesRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set + */ + function ListAcceleratorTypesRequest(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]]; + } + + /** + * ListAcceleratorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.parent = ""; + + /** + * ListAcceleratorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.pageSize = 0; + + /** + * ListAcceleratorTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.pageToken = ""; + + /** + * ListAcceleratorTypesRequest filter. + * @member {string} filter + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.filter = ""; + + /** + * ListAcceleratorTypesRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + */ + ListAcceleratorTypesRequest.prototype.orderBy = ""; + + /** + * Creates a new ListAcceleratorTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest instance + */ + ListAcceleratorTypesRequest.create = function create(properties) { + return new ListAcceleratorTypesRequest(properties); + }; + + /** + * Encodes the specified ListAcceleratorTypesRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListAcceleratorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesRequest} message ListAcceleratorTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesRequest.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.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAcceleratorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAcceleratorTypesRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAcceleratorTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListAcceleratorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} ListAcceleratorTypesRequest + */ + ListAcceleratorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListAcceleratorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest} message ListAcceleratorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAcceleratorTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListAcceleratorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListAcceleratorTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAcceleratorTypesRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAcceleratorTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest"; + }; + + return ListAcceleratorTypesRequest; + })(); + + v2alpha1.ListAcceleratorTypesResponse = (function() { + + /** + * Properties of a ListAcceleratorTypesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListAcceleratorTypesResponse + * @property {Array.|null} [acceleratorTypes] ListAcceleratorTypesResponse acceleratorTypes + * @property {string|null} [nextPageToken] ListAcceleratorTypesResponse nextPageToken + * @property {Array.|null} [unreachable] ListAcceleratorTypesResponse unreachable + */ + + /** + * Constructs a new ListAcceleratorTypesResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListAcceleratorTypesResponse. + * @implements IListAcceleratorTypesResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set + */ + function ListAcceleratorTypesResponse(properties) { + this.acceleratorTypes = []; + this.unreachable = []; + 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]]; + } + + /** + * ListAcceleratorTypesResponse acceleratorTypes. + * @member {Array.} acceleratorTypes + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.acceleratorTypes = $util.emptyArray; + + /** + * ListAcceleratorTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.nextPageToken = ""; + + /** + * ListAcceleratorTypesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + */ + ListAcceleratorTypesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListAcceleratorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse instance + */ + ListAcceleratorTypesResponse.create = function create(properties) { + return new ListAcceleratorTypesResponse(properties); + }; + + /** + * Encodes the specified ListAcceleratorTypesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acceleratorTypes != null && message.acceleratorTypes.length) + for (var i = 0; i < message.acceleratorTypes.length; ++i) + $root.google.cloud.tpu.v2alpha1.AcceleratorType.encode(message.acceleratorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListAcceleratorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListAcceleratorTypesResponse} message ListAcceleratorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAcceleratorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesResponse.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.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.acceleratorTypes && message.acceleratorTypes.length)) + message.acceleratorTypes = []; + message.acceleratorTypes.push($root.google.cloud.tpu.v2alpha1.AcceleratorType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAcceleratorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAcceleratorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAcceleratorTypesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAcceleratorTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acceleratorTypes != null && message.hasOwnProperty("acceleratorTypes")) { + if (!Array.isArray(message.acceleratorTypes)) + return "acceleratorTypes: array expected"; + for (var i = 0; i < message.acceleratorTypes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.AcceleratorType.verify(message.acceleratorTypes[i]); + if (error) + return "acceleratorTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListAcceleratorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} ListAcceleratorTypesResponse + */ + ListAcceleratorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse(); + if (object.acceleratorTypes) { + if (!Array.isArray(object.acceleratorTypes)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: array expected"); + message.acceleratorTypes = []; + for (var i = 0; i < object.acceleratorTypes.length; ++i) { + if (typeof object.acceleratorTypes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.acceleratorTypes: object expected"); + message.acceleratorTypes[i] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.fromObject(object.acceleratorTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListAcceleratorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse} message ListAcceleratorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAcceleratorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.acceleratorTypes = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.acceleratorTypes && message.acceleratorTypes.length) { + object.acceleratorTypes = []; + for (var j = 0; j < message.acceleratorTypes.length; ++j) + object.acceleratorTypes[j] = $root.google.cloud.tpu.v2alpha1.AcceleratorType.toObject(message.acceleratorTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListAcceleratorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListAcceleratorTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAcceleratorTypesResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAcceleratorTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListAcceleratorTypesResponse"; + }; + + return ListAcceleratorTypesResponse; + })(); + + v2alpha1.RuntimeVersion = (function() { + + /** + * Properties of a RuntimeVersion. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IRuntimeVersion + * @property {string|null} [name] RuntimeVersion name + * @property {string|null} [version] RuntimeVersion version + */ + + /** + * Constructs a new RuntimeVersion. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a RuntimeVersion. + * @implements IRuntimeVersion + * @constructor + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set + */ + function RuntimeVersion(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]]; + } + + /** + * RuntimeVersion name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + */ + RuntimeVersion.prototype.name = ""; + + /** + * RuntimeVersion version. + * @member {string} version + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + */ + RuntimeVersion.prototype.version = ""; + + /** + * Creates a new RuntimeVersion instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion instance + */ + RuntimeVersion.create = function create(properties) { + return new RuntimeVersion(properties); + }; + + /** + * Encodes the specified RuntimeVersion message. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + return writer; + }; + + /** + * Encodes the specified RuntimeVersion message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.RuntimeVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.IRuntimeVersion} message RuntimeVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RuntimeVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeVersion.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.cloud.tpu.v2alpha1.RuntimeVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.version = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RuntimeVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RuntimeVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RuntimeVersion message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RuntimeVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a RuntimeVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.RuntimeVersion} RuntimeVersion + */ + RuntimeVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.RuntimeVersion) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.RuntimeVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a RuntimeVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {google.cloud.tpu.v2alpha1.RuntimeVersion} message RuntimeVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RuntimeVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.version = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this RuntimeVersion to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @instance + * @returns {Object.} JSON object + */ + RuntimeVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RuntimeVersion + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.RuntimeVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RuntimeVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.RuntimeVersion"; + }; + + return RuntimeVersion; + })(); + + v2alpha1.GetRuntimeVersionRequest = (function() { + + /** + * Properties of a GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IGetRuntimeVersionRequest + * @property {string|null} [name] GetRuntimeVersionRequest name + */ + + /** + * Constructs a new GetRuntimeVersionRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a GetRuntimeVersionRequest. + * @implements IGetRuntimeVersionRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set + */ + function GetRuntimeVersionRequest(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]]; + } + + /** + * GetRuntimeVersionRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @instance + */ + GetRuntimeVersionRequest.prototype.name = ""; + + /** + * Creates a new GetRuntimeVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest instance + */ + GetRuntimeVersionRequest.create = function create(properties) { + return new GetRuntimeVersionRequest(properties); + }; + + /** + * Encodes the specified GetRuntimeVersionRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRuntimeVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetRuntimeVersionRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IGetRuntimeVersionRequest} message GetRuntimeVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetRuntimeVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRuntimeVersionRequest.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.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetRuntimeVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetRuntimeVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetRuntimeVersionRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetRuntimeVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetRuntimeVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} GetRuntimeVersionRequest + */ + GetRuntimeVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetRuntimeVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest} message GetRuntimeVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetRuntimeVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetRuntimeVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetRuntimeVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetRuntimeVersionRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetRuntimeVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetRuntimeVersionRequest"; + }; + + return GetRuntimeVersionRequest; + })(); + + v2alpha1.ListRuntimeVersionsRequest = (function() { + + /** + * Properties of a ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListRuntimeVersionsRequest + * @property {string|null} [parent] ListRuntimeVersionsRequest parent + * @property {number|null} [pageSize] ListRuntimeVersionsRequest pageSize + * @property {string|null} [pageToken] ListRuntimeVersionsRequest pageToken + * @property {string|null} [filter] ListRuntimeVersionsRequest filter + * @property {string|null} [orderBy] ListRuntimeVersionsRequest orderBy + */ + + /** + * Constructs a new ListRuntimeVersionsRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListRuntimeVersionsRequest. + * @implements IListRuntimeVersionsRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set + */ + function ListRuntimeVersionsRequest(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]]; + } + + /** + * ListRuntimeVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.parent = ""; + + /** + * ListRuntimeVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageSize = 0; + + /** + * ListRuntimeVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.pageToken = ""; + + /** + * ListRuntimeVersionsRequest filter. + * @member {string} filter + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.filter = ""; + + /** + * ListRuntimeVersionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + */ + ListRuntimeVersionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListRuntimeVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest instance + */ + ListRuntimeVersionsRequest.create = function create(properties) { + return new ListRuntimeVersionsRequest(properties); + }; + + /** + * Encodes the specified ListRuntimeVersionsRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListRuntimeVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsRequest} message ListRuntimeVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsRequest.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.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimeVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimeVersionsRequest message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimeVersionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListRuntimeVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} ListRuntimeVersionsRequest + */ + ListRuntimeVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListRuntimeVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest} message ListRuntimeVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimeVersionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListRuntimeVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimeVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRuntimeVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimeVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest"; + }; + + return ListRuntimeVersionsRequest; + })(); + + v2alpha1.ListRuntimeVersionsResponse = (function() { + + /** + * Properties of a ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IListRuntimeVersionsResponse + * @property {Array.|null} [runtimeVersions] ListRuntimeVersionsResponse runtimeVersions + * @property {string|null} [nextPageToken] ListRuntimeVersionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListRuntimeVersionsResponse unreachable + */ + + /** + * Constructs a new ListRuntimeVersionsResponse. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a ListRuntimeVersionsResponse. + * @implements IListRuntimeVersionsResponse + * @constructor + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set + */ + function ListRuntimeVersionsResponse(properties) { + this.runtimeVersions = []; + this.unreachable = []; + 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]]; + } + + /** + * ListRuntimeVersionsResponse runtimeVersions. + * @member {Array.} runtimeVersions + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.runtimeVersions = $util.emptyArray; + + /** + * ListRuntimeVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.nextPageToken = ""; + + /** + * ListRuntimeVersionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + */ + ListRuntimeVersionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListRuntimeVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse instance + */ + ListRuntimeVersionsResponse.create = function create(properties) { + return new ListRuntimeVersionsResponse(properties); + }; + + /** + * Encodes the specified ListRuntimeVersionsResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimeVersions != null && message.runtimeVersions.length) + for (var i = 0; i < message.runtimeVersions.length; ++i) + $root.google.cloud.tpu.v2alpha1.RuntimeVersion.encode(message.runtimeVersions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListRuntimeVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IListRuntimeVersionsResponse} message ListRuntimeVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimeVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsResponse.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.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.runtimeVersions && message.runtimeVersions.length)) + message.runtimeVersions = []; + message.runtimeVersions.push($root.google.cloud.tpu.v2alpha1.RuntimeVersion.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimeVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimeVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimeVersionsResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimeVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimeVersions != null && message.hasOwnProperty("runtimeVersions")) { + if (!Array.isArray(message.runtimeVersions)) + return "runtimeVersions: array expected"; + for (var i = 0; i < message.runtimeVersions.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.verify(message.runtimeVersions[i]); + if (error) + return "runtimeVersions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListRuntimeVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} ListRuntimeVersionsResponse + */ + ListRuntimeVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse(); + if (object.runtimeVersions) { + if (!Array.isArray(object.runtimeVersions)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: array expected"); + message.runtimeVersions = []; + for (var i = 0; i < object.runtimeVersions.length; ++i) { + if (typeof object.runtimeVersions[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.runtimeVersions: object expected"); + message.runtimeVersions[i] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.fromObject(object.runtimeVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimeVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse} message ListRuntimeVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimeVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.runtimeVersions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.runtimeVersions && message.runtimeVersions.length) { + object.runtimeVersions = []; + for (var j = 0; j < message.runtimeVersions.length; ++j) + object.runtimeVersions[j] = $root.google.cloud.tpu.v2alpha1.RuntimeVersion.toObject(message.runtimeVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListRuntimeVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimeVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRuntimeVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimeVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse"; + }; + + return ListRuntimeVersionsResponse; + })(); + + v2alpha1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.tpu.v2alpha1 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(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]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.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.cloud.tpu.v2alpha1.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.statusDetail = reader.string(); + break; + } + case 6: { + message.cancelRequested = reader.bool(); + break; + } + case 7: { + message.apiVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.OperationMetadata) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata + * @static + * @param {google.cloud.tpu.v2alpha1.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; return object; }; /** - * Converts this ListRuntimeVersionsResponse to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata * @instance * @returns {Object.} JSON object */ - ListRuntimeVersionsResponse.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ListRuntimeVersionsResponse + * Gets the default type url for OperationMetadata * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse + * @memberof google.cloud.tpu.v2alpha1.OperationMetadata * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ListRuntimeVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.ListRuntimeVersionsResponse"; + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.OperationMetadata"; }; - return ListRuntimeVersionsResponse; + return OperationMetadata; })(); v2alpha1.Symptom = (function() { @@ -15620,56 +30388,295 @@ /** * Encodes the specified GetGuestAttributesResponse message. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.guestAttributes != null && message.guestAttributes.length) + for (var i = 0; i < message.guestAttributes.length; ++i) + $root.google.cloud.tpu.v2alpha1.GuestAttributes.encode(message.guestAttributes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGuestAttributesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.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.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.guestAttributes && message.guestAttributes.length)) + message.guestAttributes = []; + message.guestAttributes.push($root.google.cloud.tpu.v2alpha1.GuestAttributes.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGuestAttributesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGuestAttributesResponse message. + * @function verify + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGuestAttributesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.guestAttributes != null && message.hasOwnProperty("guestAttributes")) { + if (!Array.isArray(message.guestAttributes)) + return "guestAttributes: array expected"; + for (var i = 0; i < message.guestAttributes.length; ++i) { + var error = $root.google.cloud.tpu.v2alpha1.GuestAttributes.verify(message.guestAttributes[i]); + if (error) + return "guestAttributes." + error; + } + } + return null; + }; + + /** + * Creates a GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + */ + GetGuestAttributesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) + return object; + var message = new $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); + if (object.guestAttributes) { + if (!Array.isArray(object.guestAttributes)) + throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: array expected"); + message.guestAttributes = []; + for (var i = 0; i < object.guestAttributes.length; ++i) { + if (typeof object.guestAttributes[i] !== "object") + throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: object expected"); + message.guestAttributes[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.fromObject(object.guestAttributes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} message GetGuestAttributesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGuestAttributesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.guestAttributes = []; + if (message.guestAttributes && message.guestAttributes.length) { + object.guestAttributes = []; + for (var j = 0; j < message.guestAttributes.length; ++j) + object.guestAttributes[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.toObject(message.guestAttributes[j], options); + } + return object; + }; + + /** + * Converts this GetGuestAttributesResponse to JSON. + * @function toJSON + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @instance + * @returns {Object.} JSON object + */ + GetGuestAttributesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGuestAttributesResponse + * @function getTypeUrl + * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGuestAttributesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetGuestAttributesResponse"; + }; + + return GetGuestAttributesResponse; + })(); + + v2alpha1.SimulateMaintenanceEventRequest = (function() { + + /** + * Properties of a SimulateMaintenanceEventRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @interface ISimulateMaintenanceEventRequest + * @property {string|null} [name] SimulateMaintenanceEventRequest name + * @property {Array.|null} [workerIds] SimulateMaintenanceEventRequest workerIds + */ + + /** + * Constructs a new SimulateMaintenanceEventRequest. + * @memberof google.cloud.tpu.v2alpha1 + * @classdesc Represents a SimulateMaintenanceEventRequest. + * @implements ISimulateMaintenanceEventRequest + * @constructor + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest=} [properties] Properties to set + */ + function SimulateMaintenanceEventRequest(properties) { + this.workerIds = []; + 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]]; + } + + /** + * SimulateMaintenanceEventRequest name. + * @member {string} name + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest + * @instance + */ + SimulateMaintenanceEventRequest.prototype.name = ""; + + /** + * SimulateMaintenanceEventRequest workerIds. + * @member {Array.} workerIds + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest + * @instance + */ + SimulateMaintenanceEventRequest.prototype.workerIds = $util.emptyArray; + + /** + * Creates a new SimulateMaintenanceEventRequest instance using the specified properties. + * @function create + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest + * @static + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest=} [properties] Properties to set + * @returns {google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest} SimulateMaintenanceEventRequest instance + */ + SimulateMaintenanceEventRequest.create = function create(properties) { + return new SimulateMaintenanceEventRequest(properties); + }; + + /** + * Encodes the specified SimulateMaintenanceEventRequest message. Does not implicitly {@link google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest} message SimulateMaintenanceEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetGuestAttributesResponse.encode = function encode(message, writer) { + SimulateMaintenanceEventRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.guestAttributes != null && message.guestAttributes.length) - for (var i = 0; i < message.guestAttributes.length; ++i) - $root.google.cloud.tpu.v2alpha1.GuestAttributes.encode(message.guestAttributes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.workerIds != null && message.workerIds.length) + for (var i = 0; i < message.workerIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.workerIds[i]); return writer; }; /** - * Encodes the specified GetGuestAttributesResponse message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.verify|verify} messages. + * Encodes the specified SimulateMaintenanceEventRequest message, length delimited. Does not implicitly {@link google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static - * @param {google.cloud.tpu.v2alpha1.IGetGuestAttributesResponse} message GetGuestAttributesResponse message or plain object to encode + * @param {google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest} message SimulateMaintenanceEventRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetGuestAttributesResponse.encodeDelimited = function encodeDelimited(message, writer) { + SimulateMaintenanceEventRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetGuestAttributesResponse message from the specified reader or buffer. + * Decodes a SimulateMaintenanceEventRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @returns {google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest} SimulateMaintenanceEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetGuestAttributesResponse.decode = function decode(reader, length) { + SimulateMaintenanceEventRequest.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.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - if (!(message.guestAttributes && message.guestAttributes.length)) - message.guestAttributes = []; - message.guestAttributes.push($root.google.cloud.tpu.v2alpha1.GuestAttributes.decode(reader, reader.uint32())); + message.name = reader.string(); + break; + } + case 2: { + if (!(message.workerIds && message.workerIds.length)) + message.workerIds = []; + message.workerIds.push(reader.string()); break; } default: @@ -15681,119 +30688,123 @@ }; /** - * Decodes a GetGuestAttributesResponse message from the specified reader or buffer, length delimited. + * Decodes a SimulateMaintenanceEventRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @returns {google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest} SimulateMaintenanceEventRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetGuestAttributesResponse.decodeDelimited = function decodeDelimited(reader) { + SimulateMaintenanceEventRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetGuestAttributesResponse message. + * Verifies a SimulateMaintenanceEventRequest message. * @function verify - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetGuestAttributesResponse.verify = function verify(message) { + SimulateMaintenanceEventRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.guestAttributes != null && message.hasOwnProperty("guestAttributes")) { - if (!Array.isArray(message.guestAttributes)) - return "guestAttributes: array expected"; - for (var i = 0; i < message.guestAttributes.length; ++i) { - var error = $root.google.cloud.tpu.v2alpha1.GuestAttributes.verify(message.guestAttributes[i]); - if (error) - return "guestAttributes." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.workerIds != null && message.hasOwnProperty("workerIds")) { + if (!Array.isArray(message.workerIds)) + return "workerIds: array expected"; + for (var i = 0; i < message.workerIds.length; ++i) + if (!$util.isString(message.workerIds[i])) + return "workerIds: string[] expected"; } return null; }; /** - * Creates a GetGuestAttributesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a SimulateMaintenanceEventRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} GetGuestAttributesResponse + * @returns {google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest} SimulateMaintenanceEventRequest */ - GetGuestAttributesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse) + SimulateMaintenanceEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest) return object; - var message = new $root.google.cloud.tpu.v2alpha1.GetGuestAttributesResponse(); - if (object.guestAttributes) { - if (!Array.isArray(object.guestAttributes)) - throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: array expected"); - message.guestAttributes = []; - for (var i = 0; i < object.guestAttributes.length; ++i) { - if (typeof object.guestAttributes[i] !== "object") - throw TypeError(".google.cloud.tpu.v2alpha1.GetGuestAttributesResponse.guestAttributes: object expected"); - message.guestAttributes[i] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.fromObject(object.guestAttributes[i]); - } + var message = new $root.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.workerIds) { + if (!Array.isArray(object.workerIds)) + throw TypeError(".google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest.workerIds: array expected"); + message.workerIds = []; + for (var i = 0; i < object.workerIds.length; ++i) + message.workerIds[i] = String(object.workerIds[i]); } return message; }; /** - * Creates a plain object from a GetGuestAttributesResponse message. Also converts values to other types if specified. + * Creates a plain object from a SimulateMaintenanceEventRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static - * @param {google.cloud.tpu.v2alpha1.GetGuestAttributesResponse} message GetGuestAttributesResponse + * @param {google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest} message SimulateMaintenanceEventRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetGuestAttributesResponse.toObject = function toObject(message, options) { + SimulateMaintenanceEventRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.guestAttributes = []; - if (message.guestAttributes && message.guestAttributes.length) { - object.guestAttributes = []; - for (var j = 0; j < message.guestAttributes.length; ++j) - object.guestAttributes[j] = $root.google.cloud.tpu.v2alpha1.GuestAttributes.toObject(message.guestAttributes[j], options); + object.workerIds = []; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.workerIds && message.workerIds.length) { + object.workerIds = []; + for (var j = 0; j < message.workerIds.length; ++j) + object.workerIds[j] = message.workerIds[j]; } return object; }; /** - * Converts this GetGuestAttributesResponse to JSON. + * Converts this SimulateMaintenanceEventRequest to JSON. * @function toJSON - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @instance * @returns {Object.} JSON object */ - GetGuestAttributesResponse.prototype.toJSON = function toJSON() { + SimulateMaintenanceEventRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GetGuestAttributesResponse + * Gets the default type url for SimulateMaintenanceEventRequest * @function getTypeUrl - * @memberof google.cloud.tpu.v2alpha1.GetGuestAttributesResponse + * @memberof google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GetGuestAttributesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + SimulateMaintenanceEventRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.GetGuestAttributesResponse"; + return typeUrlPrefix + "/google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest"; }; - return GetGuestAttributesResponse; + return SimulateMaintenanceEventRequest; })(); v2alpha1.ShieldedInstanceConfig = (function() { @@ -30640,6 +45651,255 @@ return rpc; })(); + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Interval = (function() { + + /** + * Properties of an Interval. + * @memberof google.type + * @interface IInterval + * @property {google.protobuf.ITimestamp|null} [startTime] Interval startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Interval endTime + */ + + /** + * Constructs a new Interval. + * @memberof google.type + * @classdesc Represents an Interval. + * @implements IInterval + * @constructor + * @param {google.type.IInterval=} [properties] Properties to set + */ + function Interval(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]]; + } + + /** + * Interval startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.type.Interval + * @instance + */ + Interval.prototype.startTime = null; + + /** + * Interval endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.type.Interval + * @instance + */ + Interval.prototype.endTime = null; + + /** + * Creates a new Interval instance using the specified properties. + * @function create + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval=} [properties] Properties to set + * @returns {google.type.Interval} Interval instance + */ + Interval.create = function create(properties) { + return new Interval(properties); + }; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @function encode + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @function decode + * @memberof google.type.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.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.type.Interval(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Interval message. + * @function verify + * @memberof google.type.Interval + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Interval.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Interval + * @static + * @param {Object.} object Plain object + * @returns {google.type.Interval} Interval + */ + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Interval) + return object; + var message = new $root.google.type.Interval(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.type.Interval.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.type.Interval.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Interval + * @static + * @param {google.type.Interval} message Interval + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Interval.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this Interval to JSON. + * @function toJSON + * @memberof google.type.Interval + * @instance + * @returns {Object.} JSON object + */ + Interval.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Interval + * @function getTypeUrl + * @memberof google.type.Interval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Interval"; + }; + + return Interval; + })(); + + return type; + })(); + return google; })(); diff --git a/packages/google-cloud-tpu/protos/protos.json b/packages/google-cloud-tpu/protos/protos.json index 9ad44e70745..fc0f3a1482f 100644 --- a/packages/google-cloud-tpu/protos/protos.json +++ b/packages/google-cloud-tpu/protos/protos.json @@ -770,6 +770,997 @@ } } }, + "v2": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/tpu/v2;tpu", + "java_multiple_files": true, + "java_outer_classname": "CloudTpuProto", + "java_package": "com.google.cloud.tpu.v2" + }, + "nested": { + "Tpu": { + "options": { + "(google.api.default_host)": "tpu.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListNodes": { + "requestType": "ListNodesRequest", + "responseType": "ListNodesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/nodes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/nodes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetNode": { + "requestType": "GetNodeRequest", + "responseType": "Node", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/nodes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/nodes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateNode": { + "requestType": "CreateNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/nodes", + "(google.api.http).body": "node", + "(google.api.method_signature)": "parent,node,node_id", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/nodes", + "body": "node" + } + }, + { + "(google.api.method_signature)": "parent,node,node_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteNode": { + "requestType": "DeleteNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/nodes/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/nodes/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "StopNode": { + "requestType": "StopNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/locations/*/nodes/*}:stop", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/locations/*/nodes/*}:stop", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "StartNode": { + "requestType": "StartNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/locations/*/nodes/*}:start", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/locations/*/nodes/*}:start", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateNode": { + "requestType": "UpdateNodeRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2/{node.name=projects/*/locations/*/nodes/*}", + "(google.api.http).body": "node", + "(google.api.method_signature)": "node,update_mask", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{node.name=projects/*/locations/*/nodes/*}", + "body": "node" + } + }, + { + "(google.api.method_signature)": "node,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "GenerateServiceIdentity": { + "requestType": "GenerateServiceIdentityRequest", + "responseType": "GenerateServiceIdentityResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}:generateServiceIdentity", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}:generateServiceIdentity", + "body": "*" + } + } + ] + }, + "ListAcceleratorTypes": { + "requestType": "ListAcceleratorTypesRequest", + "responseType": "ListAcceleratorTypesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/acceleratorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/acceleratorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetAcceleratorType": { + "requestType": "GetAcceleratorTypeRequest", + "responseType": "AcceleratorType", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/acceleratorTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/acceleratorTypes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListRuntimeVersions": { + "requestType": "ListRuntimeVersionsRequest", + "responseType": "ListRuntimeVersionsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/runtimeVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/runtimeVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetRuntimeVersion": { + "requestType": "GetRuntimeVersionRequest", + "responseType": "RuntimeVersion", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/runtimeVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/runtimeVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetGuestAttributes": { + "requestType": "GetGuestAttributesRequest", + "responseType": "GetGuestAttributesResponse", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/locations/*/nodes/*}:getGuestAttributes", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/locations/*/nodes/*}:getGuestAttributes", + "body": "*" + } + } + ] + } + } + }, + "GuestAttributes": { + "fields": { + "queryPath": { + "type": "string", + "id": 1 + }, + "queryValue": { + "type": "GuestAttributesValue", + "id": 2 + } + } + }, + "GuestAttributesValue": { + "fields": { + "items": { + "rule": "repeated", + "type": "GuestAttributesEntry", + "id": 1 + } + } + }, + "GuestAttributesEntry": { + "fields": { + "namespace": { + "type": "string", + "id": 1 + }, + "key": { + "type": "string", + "id": 2 + }, + "value": { + "type": "string", + "id": 3 + } + } + }, + "AttachedDisk": { + "fields": { + "sourceDisk": { + "type": "string", + "id": 3 + }, + "mode": { + "type": "DiskMode", + "id": 4 + } + }, + "nested": { + "DiskMode": { + "values": { + "DISK_MODE_UNSPECIFIED": 0, + "READ_WRITE": 1, + "READ_ONLY": 2 + } + } + } + }, + "SchedulingConfig": { + "fields": { + "preemptible": { + "type": "bool", + "id": 1 + }, + "reserved": { + "type": "bool", + "id": 2 + } + } + }, + "NetworkEndpoint": { + "fields": { + "ipAddress": { + "type": "string", + "id": 1 + }, + "port": { + "type": "int32", + "id": 2 + }, + "accessConfig": { + "type": "AccessConfig", + "id": 5 + } + } + }, + "AccessConfig": { + "fields": { + "externalIp": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "NetworkConfig": { + "fields": { + "network": { + "type": "string", + "id": 1 + }, + "subnetwork": { + "type": "string", + "id": 2 + }, + "enableExternalIps": { + "type": "bool", + "id": 3 + }, + "canIpForward": { + "type": "bool", + "id": 4 + } + } + }, + "ServiceAccount": { + "fields": { + "email": { + "type": "string", + "id": 1 + }, + "scope": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Node": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/Node", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/nodes/{node}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "acceleratorType": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "state": { + "type": "State", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "healthDescription": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "runtimeVersion": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "networkConfig": { + "type": "NetworkConfig", + "id": 36 + }, + "cidrBlock": { + "type": "string", + "id": 13 + }, + "serviceAccount": { + "type": "ServiceAccount", + "id": 37 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "schedulingConfig": { + "type": "SchedulingConfig", + "id": 17 + }, + "networkEndpoints": { + "rule": "repeated", + "type": "NetworkEndpoint", + "id": 21, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "health": { + "type": "Health", + "id": 22 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 24 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "tags": { + "rule": "repeated", + "type": "string", + "id": 40 + }, + "id": { + "type": "int64", + "id": 33, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dataDisks": { + "rule": "repeated", + "type": "AttachedDisk", + "id": 41 + }, + "apiVersion": { + "type": "ApiVersion", + "id": 38, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "symptoms": { + "rule": "repeated", + "type": "Symptom", + "id": 39, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "shieldedInstanceConfig": { + "type": "ShieldedInstanceConfig", + "id": 45 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "READY": 2, + "RESTARTING": 3, + "REIMAGING": 4, + "DELETING": 5, + "REPAIRING": 6, + "STOPPED": 8, + "STOPPING": 9, + "STARTING": 10, + "PREEMPTED": 11, + "TERMINATED": 12, + "HIDING": 13, + "HIDDEN": 14, + "UNHIDING": 15 + } + }, + "Health": { + "values": { + "HEALTH_UNSPECIFIED": 0, + "HEALTHY": 1, + "TIMEOUT": 3, + "UNHEALTHY_TENSORFLOW": 4, + "UNHEALTHY_MAINTENANCE": 5 + } + }, + "ApiVersion": { + "values": { + "API_VERSION_UNSPECIFIED": 0, + "V1_ALPHA1": 1, + "V1": 2, + "V2_ALPHA1": 3, + "V2": 4 + } + } + } + }, + "ListNodesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "tpu.googleapis.com/Node" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListNodesResponse": { + "fields": { + "nodes": { + "rule": "repeated", + "type": "Node", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "CreateNodeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "nodeId": { + "type": "string", + "id": 2 + }, + "node": { + "type": "Node", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "StopNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "StartNodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + } + } + }, + "UpdateNodeRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "node": { + "type": "Node", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ServiceIdentity": { + "fields": { + "email": { + "type": "string", + "id": 1 + } + } + }, + "GenerateServiceIdentityRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateServiceIdentityResponse": { + "fields": { + "identity": { + "type": "ServiceIdentity", + "id": 1 + } + } + }, + "AcceleratorType": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/AcceleratorType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + } + } + }, + "GetAcceleratorTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/AcceleratorType" + } + } + } + }, + "ListAcceleratorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "tpu.googleapis.com/AcceleratorType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 5 + }, + "orderBy": { + "type": "string", + "id": 6 + } + } + }, + "ListAcceleratorTypesResponse": { + "fields": { + "acceleratorTypes": { + "rule": "repeated", + "type": "AcceleratorType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "RuntimeVersion": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/RuntimeVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/runtimeVersions/{runtime_version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "version": { + "type": "string", + "id": 2 + } + } + }, + "GetRuntimeVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/RuntimeVersion" + } + } + } + }, + "ListRuntimeVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "tpu.googleapis.com/RuntimeVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 5 + }, + "orderBy": { + "type": "string", + "id": 6 + } + } + }, + "ListRuntimeVersionsResponse": { + "fields": { + "runtimeVersions": { + "rule": "repeated", + "type": "RuntimeVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + } + } + }, + "Symptom": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "symptomType": { + "type": "SymptomType", + "id": 2 + }, + "details": { + "type": "string", + "id": 3 + }, + "workerId": { + "type": "string", + "id": 4 + } + }, + "nested": { + "SymptomType": { + "values": { + "SYMPTOM_TYPE_UNSPECIFIED": 0, + "LOW_MEMORY": 1, + "OUT_OF_MEMORY": 2, + "EXECUTE_TIMED_OUT": 3, + "MESH_BUILD_FAIL": 4, + "HBM_OUT_OF_MEMORY": 5, + "PROJECT_ABUSE": 6 + } + } + } + }, + "GetGuestAttributesRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + }, + "queryPath": { + "type": "string", + "id": 2 + }, + "workerIds": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetGuestAttributesResponse": { + "fields": { + "guestAttributes": { + "rule": "repeated", + "type": "GuestAttributes", + "id": 1 + } + } + }, + "ShieldedInstanceConfig": { + "fields": { + "enableSecureBoot": { + "type": "bool", + "id": 1 + } + } + } + } + }, "v2alpha1": { "options": { "go_package": "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1;tpu", @@ -854,7 +1845,7 @@ "options": { "(google.api.http).delete": "/v2alpha1/{name=projects/*/locations/*/nodes/*}", "(google.api.method_signature)": "name", - "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", "(google.longrunning.operation_info).metadata_type": "OperationMetadata" }, "parsedOptions": [ @@ -868,7 +1859,7 @@ }, { "(google.longrunning.operation_info)": { - "response_type": "Node", + "response_type": "google.protobuf.Empty", "metadata_type": "OperationMetadata" } } @@ -950,6 +1941,96 @@ } ] }, + "ListQueuedResources": { + "requestType": "ListQueuedResourcesRequest", + "responseType": "ListQueuedResourcesResponse", + "options": { + "(google.api.http).get": "/v2alpha1/{parent=projects/*/locations/*}/queuedResources", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{parent=projects/*/locations/*}/queuedResources" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetQueuedResource": { + "requestType": "GetQueuedResourceRequest", + "responseType": "QueuedResource", + "options": { + "(google.api.http).get": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateQueuedResource": { + "requestType": "CreateQueuedResourceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{parent=projects/*/locations/*}/queuedResources", + "(google.api.http).body": "queued_resource", + "(google.api.method_signature)": "parent,queued_resource,queued_resource_id", + "(google.longrunning.operation_info).response_type": "QueuedResource", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{parent=projects/*/locations/*}/queuedResources", + "body": "queued_resource" + } + }, + { + "(google.api.method_signature)": "parent,queued_resource,queued_resource_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "QueuedResource", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteQueuedResource": { + "requestType": "DeleteQueuedResourceRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "QueuedResource", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha1/{name=projects/*/locations/*/queuedResources/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "QueuedResource", + "metadata_type": "OperationMetadata" + } + } + ] + }, "GenerateServiceIdentity": { "requestType": "GenerateServiceIdentityRequest", "responseType": "GenerateServiceIdentityResponse", @@ -1053,6 +2134,30 @@ } } ] + }, + "SimulateMaintenanceEvent": { + "requestType": "SimulateMaintenanceEventRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "Node", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha1/{name=projects/*/locations/*/nodes/*}:simulateMaintenanceEvent", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Node", + "metadata_type": "OperationMetadata" + } + } + ] } } }, @@ -1166,6 +2271,10 @@ "enableExternalIps": { "type": "bool", "id": 3 + }, + "canIpForward": { + "type": "bool", + "id": 4 } } }, @@ -1201,10 +2310,7 @@ }, "acceleratorType": { "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 5 }, "state": { "type": "State", @@ -1277,36 +2383,278 @@ "type": "string", "id": 40 }, - "id": { - "type": "int64", - "id": 33, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "id": { + "type": "int64", + "id": 33, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dataDisks": { + "rule": "repeated", + "type": "AttachedDisk", + "id": 41 + }, + "apiVersion": { + "type": "ApiVersion", + "id": 38, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "symptoms": { + "rule": "repeated", + "type": "Symptom", + "id": 39, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "queuedResource": { + "type": "string", + "id": 43, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "shieldedInstanceConfig": { + "type": "ShieldedInstanceConfig", + "id": 45 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "READY": 2, + "RESTARTING": 3, + "REIMAGING": 4, + "DELETING": 5, + "REPAIRING": 6, + "STOPPED": 8, + "STOPPING": 9, + "STARTING": 10, + "PREEMPTED": 11, + "TERMINATED": 12, + "HIDING": 13, + "HIDDEN": 14, + "UNHIDING": 15 + } + }, + "Health": { + "values": { + "HEALTH_UNSPECIFIED": 0, + "HEALTHY": 1, + "TIMEOUT": 3, + "UNHEALTHY_TENSORFLOW": 4, + "UNHEALTHY_MAINTENANCE": 5 + } + }, + "ApiVersion": { + "values": { + "API_VERSION_UNSPECIFIED": 0, + "V1_ALPHA1": 1, + "V1": 2, + "V2_ALPHA1": 3 + } + } + } + }, + "QueuedResource": { + "options": { + "(google.api.resource).type": "tpu.googleapis.com/QueuedResource", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/queuedResources/{queued_resource}" + }, + "oneofs": { + "resource": { + "oneof": [ + "tpu" + ] + }, + "tier": { + "oneof": [ + "bestEffort", + "guaranteed" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "tpu": { + "type": "Tpu", + "id": 2 + }, + "bestEffort": { + "type": "BestEffort", + "id": 3 + }, + "guaranteed": { + "type": "Guaranteed", + "id": 4 + }, + "queueingPolicy": { + "type": "QueueingPolicy", + "id": 5 + }, + "state": { + "type": "QueuedResourceState", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Tpu": { + "fields": { + "nodeSpec": { + "rule": "repeated", + "type": "NodeSpec", + "id": 1 + } + }, + "nested": { + "NodeSpec": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "nodeId": { + "type": "string", + "id": 2 + }, + "node": { + "type": "Node", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "BestEffort": { + "fields": {} + }, + "Guaranteed": { + "fields": { + "minDuration": { + "type": "google.protobuf.Duration", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "reserved": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "QueueingPolicy": { + "oneofs": { + "startTimingConstraints": { + "oneof": [ + "validUntilDuration", + "validUntilTime", + "validAfterDuration", + "validAfterTime", + "validInterval" + ] + } + }, + "fields": { + "validUntilDuration": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "validUntilTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "validAfterDuration": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "validAfterTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "validInterval": { + "type": "google.type.Interval", + "id": 5 + } + } + } + } + }, + "QueuedResourceState": { + "oneofs": { + "stateData": { + "oneof": [ + "creatingData", + "acceptedData", + "provisioningData", + "failedData", + "deletingData", + "activeData", + "suspendingData", + "suspendedData" + ] + } + }, + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "creatingData": { + "type": "CreatingData", + "id": 2 + }, + "acceptedData": { + "type": "AcceptedData", + "id": 3 + }, + "provisioningData": { + "type": "ProvisioningData", + "id": 4 + }, + "failedData": { + "type": "FailedData", + "id": 5 }, - "dataDisks": { - "rule": "repeated", - "type": "AttachedDisk", - "id": 41 + "deletingData": { + "type": "DeletingData", + "id": 6 }, - "apiVersion": { - "type": "ApiVersion", - "id": 38, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "activeData": { + "type": "ActiveData", + "id": 7 }, - "symptoms": { - "rule": "repeated", - "type": "Symptom", - "id": 39, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } + "suspendingData": { + "type": "SuspendingData", + "id": 8 }, - "shieldedInstanceConfig": { - "type": "ShieldedInstanceConfig", - "id": 45 + "suspendedData": { + "type": "SuspendedData", + "id": 9 } }, "nested": { @@ -1314,37 +2662,43 @@ "values": { "STATE_UNSPECIFIED": 0, "CREATING": 1, - "READY": 2, - "RESTARTING": 3, - "REIMAGING": 4, + "ACCEPTED": 2, + "PROVISIONING": 3, + "FAILED": 4, "DELETING": 5, - "REPAIRING": 6, - "STOPPED": 8, - "STOPPING": 9, - "STARTING": 10, - "PREEMPTED": 11, - "TERMINATED": 12, - "HIDING": 13, - "HIDDEN": 14, - "UNHIDING": 15 + "ACTIVE": 6, + "SUSPENDING": 7, + "SUSPENDED": 8 } }, - "Health": { - "values": { - "HEALTH_UNSPECIFIED": 0, - "HEALTHY": 1, - "TIMEOUT": 3, - "UNHEALTHY_TENSORFLOW": 4, - "UNHEALTHY_MAINTENANCE": 5 - } + "CreatingData": { + "fields": {} }, - "ApiVersion": { - "values": { - "API_VERSION_UNSPECIFIED": 0, - "V1_ALPHA1": 1, - "V1": 2, - "V2_ALPHA1": 3 + "AcceptedData": { + "fields": {} + }, + "ProvisioningData": { + "fields": {} + }, + "FailedData": { + "fields": { + "error": { + "type": "google.rpc.Status", + "id": 1 + } } + }, + "DeletingData": { + "fields": {} + }, + "ActiveData": { + "fields": {} + }, + "SuspendingData": { + "fields": {} + }, + "SuspendedData": { + "fields": {} } } }, @@ -1355,7 +2709,7 @@ "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + "(google.api.resource_reference).child_type": "tpu.googleapis.com/Node" } }, "pageSize": { @@ -1418,6 +2772,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "requestId": { + "type": "string", + "id": 6 } } }, @@ -1430,6 +2788,10 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "tpu.googleapis.com/Node" } + }, + "requestId": { + "type": "string", + "id": 3 } } }, @@ -1437,7 +2799,11 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } } } }, @@ -1445,7 +2811,11 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } } } }, @@ -1467,6 +2837,99 @@ } } }, + "ListQueuedResourcesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "tpu.googleapis.com/QueuedResource" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListQueuedResourcesResponse": { + "fields": { + "queuedResources": { + "rule": "repeated", + "type": "QueuedResource", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetQueuedResourceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/QueuedResource" + } + } + } + }, + "CreateQueuedResourceRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "queuedResourceId": { + "type": "string", + "id": 2 + }, + "queuedResource": { + "type": "QueuedResource", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "requestId": { + "type": "string", + "id": 4 + } + } + }, + "DeleteQueuedResourceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/QueuedResource" + } + }, + "requestId": { + "type": "string", + "id": 2 + } + } + }, "ServiceIdentity": { "fields": { "email": { @@ -1530,7 +2993,7 @@ "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "tpu.googleapis.com/AcceleratorType" + "(google.api.resource_reference).child_type": "tpu.googleapis.com/AcceleratorType" } }, "pageSize": { @@ -1569,38 +3032,6 @@ } } }, - "OperationMetadata": { - "fields": { - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "target": { - "type": "string", - "id": 3 - }, - "verb": { - "type": "string", - "id": 4 - }, - "statusDetail": { - "type": "string", - "id": 5 - }, - "cancelRequested": { - "type": "bool", - "id": 6 - }, - "apiVersion": { - "type": "string", - "id": 7 - } - } - }, "RuntimeVersion": { "options": { "(google.api.resource).type": "tpu.googleapis.com/RuntimeVersion", @@ -1636,7 +3067,7 @@ "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "tpu.googleapis.com/RuntimeVersion" + "(google.api.resource_reference).child_type": "tpu.googleapis.com/RuntimeVersion" } }, "pageSize": { @@ -1675,6 +3106,38 @@ } } }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + } + } + }, "Symptom": { "fields": { "createTime": { @@ -1738,6 +3201,23 @@ } } }, + "SimulateMaintenanceEventRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "tpu.googleapis.com/Node" + } + }, + "workerIds": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, "ShieldedInstanceConfig": { "fields": { "enableSecureBoot": { @@ -3187,6 +4667,30 @@ } } } + }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/interval;interval", + "java_multiple_files": true, + "java_outer_classname": "IntervalProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Interval": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } } } } diff --git a/packages/google-cloud-tpu/samples/README.md b/packages/google-cloud-tpu/samples/README.md index 2f15c64e186..5e078745dfd 100644 --- a/packages/google-cloud-tpu/samples/README.md +++ b/packages/google-cloud-tpu/samples/README.md @@ -36,6 +36,24 @@ * [Tpu.start_node](#tpu.start_node) * [Tpu.stop_node](#tpu.stop_node) * [Tpu.update_node](#tpu.update_node) + * [Tpu.create_node](#tpu.create_node) + * [Tpu.create_queued_resource](#tpu.create_queued_resource) + * [Tpu.delete_node](#tpu.delete_node) + * [Tpu.delete_queued_resource](#tpu.delete_queued_resource) + * [Tpu.generate_service_identity](#tpu.generate_service_identity) + * [Tpu.get_accelerator_type](#tpu.get_accelerator_type) + * [Tpu.get_guest_attributes](#tpu.get_guest_attributes) + * [Tpu.get_node](#tpu.get_node) + * [Tpu.get_queued_resource](#tpu.get_queued_resource) + * [Tpu.get_runtime_version](#tpu.get_runtime_version) + * [Tpu.list_accelerator_types](#tpu.list_accelerator_types) + * [Tpu.list_nodes](#tpu.list_nodes) + * [Tpu.list_queued_resources](#tpu.list_queued_resources) + * [Tpu.list_runtime_versions](#tpu.list_runtime_versions) + * [Tpu.simulate_maintenance_event](#tpu.simulate_maintenance_event) + * [Tpu.start_node](#tpu.start_node) + * [Tpu.stop_node](#tpu.stop_node) + * [Tpu.update_node](#tpu.update_node) * [Quickstart](#quickstart) * [Quickstart](#quickstart) @@ -241,6 +259,227 @@ __Usage:__ +### Tpu.create_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js` + + +----- + + + + +### Tpu.delete_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js` + + +----- + + + + +### Tpu.generate_service_identity + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js` + + +----- + + + + +### Tpu.get_accelerator_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js` + + +----- + + + + +### Tpu.get_guest_attributes + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js` + + +----- + + + + +### Tpu.get_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js` + + +----- + + + + +### Tpu.get_runtime_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js` + + +----- + + + + +### Tpu.list_accelerator_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js` + + +----- + + + + +### Tpu.list_nodes + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js` + + +----- + + + + +### Tpu.list_runtime_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js` + + +----- + + + + +### Tpu.start_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js` + + +----- + + + + +### Tpu.stop_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js` + + +----- + + + + +### Tpu.update_node + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js` + + +----- + + + + ### Tpu.create_node View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js). @@ -258,6 +497,23 @@ __Usage:__ +### Tpu.create_queued_resource + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js` + + +----- + + + + ### Tpu.delete_node View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js). @@ -275,6 +531,23 @@ __Usage:__ +### Tpu.delete_queued_resource + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js` + + +----- + + + + ### Tpu.generate_service_identity View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.generate_service_identity.js). @@ -343,6 +616,23 @@ __Usage:__ +### Tpu.get_queued_resource + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js` + + +----- + + + + ### Tpu.get_runtime_version View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_runtime_version.js). @@ -394,6 +684,23 @@ __Usage:__ +### Tpu.list_queued_resources + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js` + + +----- + + + + ### Tpu.list_runtime_versions View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_runtime_versions.js). @@ -411,6 +718,23 @@ __Usage:__ +### Tpu.simulate_maintenance_event + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js` + + +----- + + + + ### Tpu.start_node View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js). diff --git a/packages/google-cloud-tpu/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json b/packages/google-cloud-tpu/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json new file mode 100644 index 00000000000..ee43d222fe8 --- /dev/null +++ b/packages/google-cloud-tpu/samples/generated/v2/snippet_metadata.google.cloud.tpu.v2.json @@ -0,0 +1,595 @@ +{ + "clientLibrary": { + "name": "nodejs-tpu", + "version": "2.2.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.tpu.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "tpu_v2_generated_Tpu_ListNodes_async", + "title": "Tpu listNodes Sample", + "origin": "API_DEFINITION", + "description": " Lists nodes.", + "canonical": true, + "file": "tpu.list_nodes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListNodesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListNodes", + "fullName": "google.cloud.tpu.v2.Tpu.ListNodes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetNode_async", + "title": "Tpu getNode Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a node.", + "canonical": true, + "file": "tpu.get_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2.Tpu.GetNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.Node", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetNode", + "fullName": "google.cloud.tpu.v2.Tpu.GetNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_CreateNode_async", + "title": "Tpu createNode Sample", + "origin": "API_DEFINITION", + "description": " Creates a node.", + "canonical": true, + "file": "tpu.create_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "node_id", + "type": "TYPE_STRING" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "CreateNode", + "fullName": "google.cloud.tpu.v2.Tpu.CreateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_DeleteNode_async", + "title": "Tpu deleteNode Sample", + "origin": "API_DEFINITION", + "description": " Deletes a node.", + "canonical": true, + "file": "tpu.delete_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "DeleteNode", + "fullName": "google.cloud.tpu.v2.Tpu.DeleteNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_StopNode_async", + "title": "Tpu stopNode Sample", + "origin": "API_DEFINITION", + "description": " Stops a node. This operation is only available with single TPU nodes.", + "canonical": true, + "file": "tpu.stop_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2.Tpu.StopNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "StopNode", + "fullName": "google.cloud.tpu.v2.Tpu.StopNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_StartNode_async", + "title": "Tpu startNode Sample", + "origin": "API_DEFINITION", + "description": " Starts a node.", + "canonical": true, + "file": "tpu.start_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2.Tpu.StartNode", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "StartNode", + "fullName": "google.cloud.tpu.v2.Tpu.StartNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_UpdateNode_async", + "title": "Tpu updateNode Sample", + "origin": "API_DEFINITION", + "description": " Updates the configurations of a node.", + "canonical": true, + "file": "tpu.update_node.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "node", + "type": ".google.cloud.tpu.v2.Node" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "UpdateNode", + "fullName": "google.cloud.tpu.v2.Tpu.UpdateNode", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GenerateServiceIdentity_async", + "title": "Tpu generateServiceIdentity Sample", + "origin": "API_DEFINITION", + "description": " Generates the Cloud TPU service identity for the project.", + "canonical": true, + "file": "tpu.generate_service_identity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.GenerateServiceIdentityResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GenerateServiceIdentity", + "fullName": "google.cloud.tpu.v2.Tpu.GenerateServiceIdentity", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_ListAcceleratorTypes_async", + "title": "Tpu listAcceleratorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists accelerator types supported by this API.", + "canonical": true, + "file": "tpu.list_accelerator_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListAcceleratorTypesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListAcceleratorTypes", + "fullName": "google.cloud.tpu.v2.Tpu.ListAcceleratorTypes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetAcceleratorType_async", + "title": "Tpu getAcceleratorType Sample", + "origin": "API_DEFINITION", + "description": " Gets AcceleratorType.", + "canonical": true, + "file": "tpu.get_accelerator_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.AcceleratorType", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetAcceleratorType", + "fullName": "google.cloud.tpu.v2.Tpu.GetAcceleratorType", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_ListRuntimeVersions_async", + "title": "Tpu listRuntimeVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists runtime versions supported by this API.", + "canonical": true, + "file": "tpu.list_runtime_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", + "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" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.ListRuntimeVersionsResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "ListRuntimeVersions", + "fullName": "google.cloud.tpu.v2.Tpu.ListRuntimeVersions", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetRuntimeVersion_async", + "title": "Tpu getRuntimeVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a runtime version.", + "canonical": true, + "file": "tpu.get_runtime_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2.RuntimeVersion", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetRuntimeVersion", + "fullName": "google.cloud.tpu.v2.Tpu.GetRuntimeVersion", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2_generated_Tpu_GetGuestAttributes_async", + "title": "Tpu getGuestAttributes Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the guest attributes for the node.", + "canonical": true, + "file": "tpu.get_guest_attributes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "query_path", + "type": "TYPE_STRING" + }, + { + "name": "worker_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.tpu.v2.GetGuestAttributesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2.TpuClient" + }, + "method": { + "shortName": "GetGuestAttributes", + "fullName": "google.cloud.tpu.v2.Tpu.GetGuestAttributes", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2.Tpu" + } + } + } + } + ] +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.create_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.create_node.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.delete_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.delete_node.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.generate_service_identity.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.generate_service_identity.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_accelerator_type.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.get_accelerator_type.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_guest_attributes.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.get_guest_attributes.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.get_node.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.get_runtime_version.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.get_runtime_version.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_accelerator_types.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.list_accelerator_types.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_nodes.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.list_nodes.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.list_runtime_versions.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.list_runtime_versions.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.start_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.start_node.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.stop_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.stop_node.js diff --git a/owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js b/packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/samples/generated/v2/tpu.update_node.js rename to packages/google-cloud-tpu/samples/generated/v2/tpu.update_node.js diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json index 41d92903b0a..04567baff21 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/snippet_metadata.google.cloud.tpu.v2alpha1.json @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 63, + "end": 67, "type": "FULL" } ], @@ -130,6 +130,10 @@ { "name": "node", "type": ".google.cloud.tpu.v2alpha1.Node" + }, + { + "name": "request_id", + "type": "TYPE_STRING" } ], "resultType": ".google.longrunning.Operation", @@ -158,7 +162,7 @@ "segments": [ { "start": 25, - "end": 54, + "end": 58, "type": "FULL" } ], @@ -170,6 +174,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" } ], "resultType": ".google.longrunning.Operation", @@ -198,7 +206,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 54, "type": "FULL" } ], @@ -238,7 +246,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 54, "type": "FULL" } ], @@ -278,7 +286,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 61, "type": "FULL" } ], @@ -311,6 +319,190 @@ } } }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_ListQueuedResources_async", + "title": "Tpu listQueuedResources Sample", + "origin": "API_DEFINITION", + "description": " Lists queued resources.", + "canonical": true, + "file": "tpu.list_queued_resources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListQueuedResources", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.ListQueuedResourcesResponse", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "ListQueuedResources", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.ListQueuedResources", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_GetQueuedResource_async", + "title": "Tpu getQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a queued resource.", + "canonical": true, + "file": "tpu.get_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.tpu.v2alpha1.QueuedResource", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "GetQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.GetQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async", + "title": "Tpu createQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Creates a QueuedResource TPU instance.", + "canonical": true, + "file": "tpu.create_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "queued_resource_id", + "type": "TYPE_STRING" + }, + { + "name": "queued_resource", + "type": ".google.cloud.tpu.v2alpha1.QueuedResource" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "CreateQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.CreateQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async", + "title": "Tpu deleteQueuedResource Sample", + "origin": "API_DEFINITION", + "description": " Deletes a QueuedResource TPU instance.", + "canonical": true, + "file": "tpu.delete_queued_resource.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "DeleteQueuedResource", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.DeleteQueuedResource", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } + }, { "regionTag": "tpu_v2alpha1_generated_Tpu_GenerateServiceIdentity_async", "title": "Tpu generateServiceIdentity Sample", @@ -590,6 +782,50 @@ } } } + }, + { + "regionTag": "tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async", + "title": "Tpu simulateMaintenanceEvent Sample", + "origin": "API_DEFINITION", + "description": " Simulates a maintenance event.", + "canonical": true, + "file": "tpu.simulate_maintenance_event.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SimulateMaintenanceEvent", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "worker_ids", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TpuClient", + "fullName": "google.cloud.tpu.v2alpha1.TpuClient" + }, + "method": { + "shortName": "SimulateMaintenanceEvent", + "fullName": "google.cloud.tpu.v2alpha1.Tpu.SimulateMaintenanceEvent", + "service": { + "shortName": "Tpu", + "fullName": "google.cloud.tpu.v2alpha1.Tpu" + } + } + } } ] } \ No newline at end of file diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js index e99cae62be7..98e5bbe23b2 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_node.js @@ -40,6 +40,10 @@ function main(parent, node) { * Required. The node. */ // const node = {} + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' // Imports the Tpu library const {TpuClient} = require('@google-cloud/tpu').v2alpha1; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.create_queued_resource.js rename to packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.create_queued_resource.js diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js index c61789134fb..694da219d05 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_node.js @@ -32,6 +32,10 @@ function main(name) { * Required. The resource name. */ // const name = 'abc123' + /** + * Idempotent request UUID. + */ + // const requestId = 'abc123' // Imports the Tpu library const {TpuClient} = require('@google-cloud/tpu').v2alpha1; diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.delete_queued_resource.js rename to packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.delete_queued_resource.js diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.get_queued_resource.js rename to packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.get_queued_resource.js diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.list_queued_resources.js rename to packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.list_queued_resources.js diff --git a/owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2alpha1/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js rename to packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.simulate_maintenance_event.js diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js index 047f5124c7b..a1f1418e8a4 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.start_node.js @@ -20,7 +20,7 @@ 'use strict'; -function main() { +function main(name) { // [START tpu_v2alpha1_generated_Tpu_StartNode_async] /** * This snippet has been automatically generated and should be regarded as a code template only. @@ -29,7 +29,7 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * The resource name. + * Required. The resource name. */ // const name = 'abc123' @@ -42,6 +42,7 @@ function main() { async function callStartNode() { // Construct request const request = { + name, }; // Run request diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js index 21ceb97b54b..57304cc5003 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.stop_node.js @@ -20,7 +20,7 @@ 'use strict'; -function main() { +function main(name) { // [START tpu_v2alpha1_generated_Tpu_StopNode_async] /** * This snippet has been automatically generated and should be regarded as a code template only. @@ -29,7 +29,7 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * The resource name. + * Required. The resource name. */ // const name = 'abc123' @@ -42,6 +42,7 @@ function main() { async function callStopNode() { // Construct request const request = { + name, }; // Run request diff --git a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js index 80769d98505..642d3f00743 100644 --- a/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js +++ b/packages/google-cloud-tpu/samples/generated/v2alpha1/tpu.update_node.js @@ -30,7 +30,8 @@ function main(updateMask, node) { */ /** * Required. Mask of fields from Node Tpu.Node to update. - * Supported fields: None. + * Supported fields: description, tags, labels, metadata, + * network_config.enable_external_ips. */ // const updateMask = {} /** diff --git a/packages/google-cloud-tpu/src/index.ts b/packages/google-cloud-tpu/src/index.ts index 6c691aaef41..a7a98675e03 100644 --- a/packages/google-cloud-tpu/src/index.ts +++ b/packages/google-cloud-tpu/src/index.ts @@ -17,12 +17,13 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v2 from './v2'; import * as v2alpha1 from './v2alpha1'; const TpuClient = v1.TpuClient; type TpuClient = v1.TpuClient; -export {v1, v2alpha1, TpuClient}; -export default {v1, v2alpha1, TpuClient}; +export {v1, v2, v2alpha1, TpuClient}; +export default {v1, v2, v2alpha1, TpuClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-tpu/src/v1/tpu_client.ts b/packages/google-cloud-tpu/src/v1/tpu_client.ts index 36dec5dd088..4e2da01a427 100644 --- a/packages/google-cloud-tpu/src/v1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v1/tpu_client.ts @@ -128,6 +128,9 @@ export class TpuClient { (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; diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/gapic_metadata.json b/packages/google-cloud-tpu/src/v2/gapic_metadata.json similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/src/v2/gapic_metadata.json rename to packages/google-cloud-tpu/src/v2/gapic_metadata.json diff --git a/owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts b/packages/google-cloud-tpu/src/v2/index.ts similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v1/src/v1/index.ts rename to packages/google-cloud-tpu/src/v2/index.ts diff --git a/packages/google-cloud-tpu/src/v2/tpu_client.ts b/packages/google-cloud-tpu/src/v2/tpu_client.ts new file mode 100644 index 00000000000..c661c50335a --- /dev/null +++ b/packages/google-cloud-tpu/src/v2/tpu_client.ts @@ -0,0 +1,2735 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + 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/tpu_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './tpu_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages TPU nodes and other resources + * + * TPU API v2 + * @class + * @memberof v2 + */ +export class TpuClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + tpuStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TpuClient. + * + * @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 TpuClient({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 TpuClient; + 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.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 = { + acceleratorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + nodePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/nodes/{node}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' + ), + }; + + // 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 = { + listNodes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'nodes' + ), + listAcceleratorTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'acceleratorTypes' + ), + listRuntimeVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'runtimeVersions' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v1alpha1/{name=projects/*/locations/*}', + additional_bindings: [ + {get: '/v1/{name=projects/*/locations/*}'}, + {get: '/v2alpha1/{name=projects/*/locations/*}'}, + {get: '/v2/{name=projects/*/locations/*}'}, + ], + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1alpha1/{name=projects/*}/locations', + additional_bindings: [ + {get: '/v1/{name=projects/*}/locations'}, + {get: '/v2alpha1/{name=projects/*}/locations'}, + {get: '/v2/{name=projects/*}/locations'}, + ], + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v1/{name=projects/*/locations/*/operations/*}:cancel'}, + { + post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel', + }, + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + {delete: '/v1/{name=projects/*/locations/*/operations/*}'}, + {delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}'}, + {delete: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1alpha1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + {get: '/v1/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2alpha1/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1alpha1/{name=projects/*/locations/*}/operations', + additional_bindings: [ + {get: '/v1/{name=projects/*/locations/*}/operations'}, + {get: '/v2alpha1/{name=projects/*/locations/*}/operations'}, + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node' + ) as gax.protobuf.Type; + const createNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata' + ) as gax.protobuf.Type; + const deleteNodeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata' + ) as gax.protobuf.Type; + const stopNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node' + ) as gax.protobuf.Type; + const stopNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata' + ) as gax.protobuf.Type; + const startNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node' + ) as gax.protobuf.Type; + const startNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata' + ) as gax.protobuf.Type; + const updateNodeResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.Node' + ) as gax.protobuf.Type; + const updateNodeMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createNodeResponse.decode.bind(createNodeResponse), + createNodeMetadata.decode.bind(createNodeMetadata) + ), + deleteNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteNodeResponse.decode.bind(deleteNodeResponse), + deleteNodeMetadata.decode.bind(deleteNodeMetadata) + ), + stopNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + stopNodeResponse.decode.bind(stopNodeResponse), + stopNodeMetadata.decode.bind(stopNodeMetadata) + ), + startNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + startNodeResponse.decode.bind(startNodeResponse), + startNodeMetadata.decode.bind(startNodeMetadata) + ), + updateNode: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateNodeResponse.decode.bind(updateNodeResponse), + updateNodeMetadata.decode.bind(updateNodeMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.tpu.v2.Tpu', + 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.tpuStub) { + return this.tpuStub; + } + + // Put together the "service stub" for + // google.cloud.tpu.v2.Tpu. + this.tpuStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.tpu.v2.Tpu' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.tpu.v2.Tpu, + 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 tpuStubMethods = [ + 'listNodes', + 'getNode', + 'createNode', + 'deleteNode', + 'stopNode', + 'startNode', + 'updateNode', + 'generateServiceIdentity', + 'listAcceleratorTypes', + 'getAcceleratorType', + 'listRuntimeVersions', + 'getRuntimeVersion', + 'getGuestAttributes', + ]; + for (const methodName of tpuStubMethods) { + const callPromise = this.tpuStub.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.tpuStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'tpu.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 'tpu.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 the details of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [Node]{@link google.cloud.tpu.v2.Node}. + * 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/tpu.get_node.js + * region_tag:tpu_v2_generated_Tpu_GetNode_async + */ + getNode( + request?: protos.google.cloud.tpu.v2.IGetNodeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | undefined, + {} | undefined + ] + >; + getNode( + request: protos.google.cloud.tpu.v2.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): void; + getNode( + request: protos.google.cloud.tpu.v2.IGetNodeRequest, + callback: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): void; + getNode( + request?: protos.google.cloud.tpu.v2.IGetNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IGetNodeRequest | 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.getNode(request, options, callback); + } + /** + * Generates the Cloud TPU service identity for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @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 [GenerateServiceIdentityResponse]{@link google.cloud.tpu.v2.GenerateServiceIdentityResponse}. + * 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/tpu.generate_service_identity.js + * region_tag:tpu_v2_generated_Tpu_GenerateServiceIdentity_async + */ + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest | undefined, + {} | undefined + ] + >; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateServiceIdentity( + request: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateServiceIdentity( + request?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + | protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse, + protos.google.cloud.tpu.v2.IGenerateServiceIdentityRequest | 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.generateServiceIdentity( + request, + options, + callback + ); + } + /** + * Gets AcceleratorType. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. + * 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/tpu.get_accelerator_type.js + * region_tag:tpu_v2_generated_Tpu_GetAcceleratorType_async + */ + getAcceleratorType( + request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest | undefined, + {} | undefined + ] + >; + getAcceleratorType( + request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest | null | undefined, + {} | null | undefined + > + ): void; + getAcceleratorType( + request: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest | null | undefined, + {} | null | undefined + > + ): void; + getAcceleratorType( + request?: protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + | protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IAcceleratorType, + protos.google.cloud.tpu.v2.IGetAcceleratorTypeRequest | 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.getAcceleratorType(request, options, callback); + } + /** + * Gets a runtime version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. + * 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/tpu.get_runtime_version.js + * region_tag:tpu_v2_generated_Tpu_GetRuntimeVersion_async + */ + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest | undefined, + {} | undefined + ] + >; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getRuntimeVersion( + request: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getRuntimeVersion( + request?: protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + | protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IRuntimeVersion, + protos.google.cloud.tpu.v2.IGetRuntimeVersionRequest | 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.getRuntimeVersion(request, options, callback); + } + /** + * Retrieves the guest attributes for the node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.queryPath + * The guest attributes path to be queried. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, all workers' GuestAttributes 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 [GetGuestAttributesResponse]{@link google.cloud.tpu.v2.GetGuestAttributesResponse}. + * 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/tpu.get_guest_attributes.js + * region_tag:tpu_v2_generated_Tpu_GetGuestAttributes_async + */ + getGuestAttributes( + request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest | undefined, + {} | undefined + ] + >; + getGuestAttributes( + request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest | null | undefined, + {} | null | undefined + > + ): void; + getGuestAttributes( + request: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + callback: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest | null | undefined, + {} | null | undefined + > + ): void; + getGuestAttributes( + request?: protos.google.cloud.tpu.v2.IGetGuestAttributesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + | protos.google.cloud.tpu.v2.IGetGuestAttributesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IGetGuestAttributesResponse, + protos.google.cloud.tpu.v2.IGetGuestAttributesRequest | 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.getGuestAttributes(request, options, callback); + } + + /** + * Creates a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {string} request.nodeId + * The unqualified resource name. + * @param {google.cloud.tpu.v2.Node} request.node + * Required. The node. + * @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/tpu.create_node.js + * region_tag:tpu_v2_generated_Tpu_CreateNode_async + */ + createNode( + request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createNode( + request: protos.google.cloud.tpu.v2.ICreateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createNode( + request: protos.google.cloud.tpu.v2.ICreateNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createNode( + request?: protos.google.cloud.tpu.v2.ICreateNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + 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.createNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createNode()`. + * @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/tpu.create_node.js + * region_tag:tpu_v2_generated_Tpu_CreateNode_async + */ + async checkCreateNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + > + > { + 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.createNode, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + >; + } + /** + * Deletes a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.delete_node.js + * region_tag:tpu_v2_generated_Tpu_DeleteNode_async + */ + deleteNode( + request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteNode( + request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteNode( + request: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteNode( + request?: protos.google.cloud.tpu.v2.IDeleteNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + 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.deleteNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteNode()`. + * @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/tpu.delete_node.js + * region_tag:tpu_v2_generated_Tpu_DeleteNode_async + */ + async checkDeleteNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.tpu.v2.OperationMetadata + > + > { + 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.deleteNode, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.tpu.v2.OperationMetadata + >; + } + /** + * Stops a node. This operation is only available with single TPU nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.stop_node.js + * region_tag:tpu_v2_generated_Tpu_StopNode_async + */ + stopNode( + request?: protos.google.cloud.tpu.v2.IStopNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + stopNode( + request: protos.google.cloud.tpu.v2.IStopNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + stopNode( + request: protos.google.cloud.tpu.v2.IStopNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + stopNode( + request?: protos.google.cloud.tpu.v2.IStopNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + 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.stopNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `stopNode()`. + * @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/tpu.stop_node.js + * region_tag:tpu_v2_generated_Tpu_StopNode_async + */ + async checkStopNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + > + > { + 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.stopNode, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + >; + } + /** + * Starts a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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/tpu.start_node.js + * region_tag:tpu_v2_generated_Tpu_StartNode_async + */ + startNode( + request?: protos.google.cloud.tpu.v2.IStartNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + startNode( + request: protos.google.cloud.tpu.v2.IStartNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + startNode( + request: protos.google.cloud.tpu.v2.IStartNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + startNode( + request?: protos.google.cloud.tpu.v2.IStartNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + 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.startNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `startNode()`. + * @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/tpu.start_node.js + * region_tag:tpu_v2_generated_Tpu_StartNode_async + */ + async checkStartNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + > + > { + 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.startNode, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + >; + } + /** + * Updates the configurations of a node. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Mask of fields from {@link Tpu.Node|Node} to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * @param {google.cloud.tpu.v2.Node} request.node + * Required. The node. Only fields specified in update_mask are updated. + * @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/tpu.update_node.js + * region_tag:tpu_v2_generated_Tpu_UpdateNode_async + */ + updateNode( + request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateNode( + request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateNode( + request: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateNode( + request?: protos.google.cloud.tpu.v2.IUpdateNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >, + 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({ + 'node.name': request.node!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateNode(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateNode()`. + * @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/tpu.update_node.js + * region_tag:tpu_v2_generated_Tpu_UpdateNode_async + */ + async checkUpdateNodeProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + > + > { + 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.updateNode, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2.Node, + protos.google.cloud.tpu.v2.OperationMetadata + >; + } + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.INode[], + protos.google.cloud.tpu.v2.IListNodesRequest | null, + protos.google.cloud.tpu.v2.IListNodesResponse + ] + >; + listNodes( + request: protos.google.cloud.tpu.v2.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2.INode + > + ): void; + listNodes( + request: protos.google.cloud.tpu.v2.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2.INode + > + ): void; + listNodes( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2.INode + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListNodesRequest, + protos.google.cloud.tpu.v2.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2.INode + > + ): Promise< + [ + protos.google.cloud.tpu.v2.INode[], + protos.google.cloud.tpu.v2.IListNodesRequest | null, + protos.google.cloud.tpu.v2.IListNodesResponse + ] + > | 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.listNodes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listNodes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v2.Node}. 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/tpu.list_nodes.js + * region_tag:tpu_v2_generated_Tpu_ListNodes_async + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v2.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists accelerator types supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. + * 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IAcceleratorType[], + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest | null, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + ] + >; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IAcceleratorType + > + ): void; + listAcceleratorTypes( + request: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IAcceleratorType + > + ): void; + listAcceleratorTypes( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IAcceleratorType + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + | protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IAcceleratorType + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IAcceleratorType[], + protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest | null, + protos.google.cloud.tpu.v2.IListAcceleratorTypesResponse + ] + > | 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.listAcceleratorTypes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType} 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 `listAcceleratorTypesAsync()` + * 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. + */ + listAcceleratorTypesStream( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.createStream( + this.innerApiCalls.listAcceleratorTypes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAcceleratorTypes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [AcceleratorType]{@link google.cloud.tpu.v2.AcceleratorType}. 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/tpu.list_accelerator_types.js + * region_tag:tpu_v2_generated_Tpu_ListAcceleratorTypes_async + */ + listAcceleratorTypesAsync( + request?: protos.google.cloud.tpu.v2.IListAcceleratorTypesRequest, + 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['listAcceleratorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAcceleratorTypes.asyncIterate( + this.innerApiCalls['listAcceleratorTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists runtime versions supported by this API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. + * 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2.IRuntimeVersion[], + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest | null, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + ] + >; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion + > + ): void; + listRuntimeVersions( + request: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion + > + ): void; + listRuntimeVersions( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + | protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + | null + | undefined, + protos.google.cloud.tpu.v2.IRuntimeVersion + > + ): Promise< + [ + protos.google.cloud.tpu.v2.IRuntimeVersion[], + protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest | null, + protos.google.cloud.tpu.v2.IListRuntimeVersionsResponse + ] + > | 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.listRuntimeVersions(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion} 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 `listRuntimeVersionsAsync()` + * 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. + */ + listRuntimeVersionsStream( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.createStream( + this.innerApiCalls.listRuntimeVersions as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listRuntimeVersions`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @param {string} request.filter + * List filter. + * @param {string} request.orderBy + * Sort 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 + * [RuntimeVersion]{@link google.cloud.tpu.v2.RuntimeVersion}. 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/tpu.list_runtime_versions.js + * region_tag:tpu_v2_generated_Tpu_ListRuntimeVersions_async + */ + listRuntimeVersionsAsync( + request?: protos.google.cloud.tpu.v2.IListRuntimeVersionsRequest, + 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['listRuntimeVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRuntimeVersions.asyncIterate( + this.innerApiCalls['listRuntimeVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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 [Location]{@link google.cloud.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 + * [Location]{@link google.cloud.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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 acceleratorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} accelerator_type + * @returns {string} Resource name string. + */ + acceleratorTypePath( + project: string, + location: string, + acceleratorType: string + ) { + return this.pathTemplates.acceleratorTypePathTemplate.render({ + project: project, + location: location, + accelerator_type: acceleratorType, + }); + } + + /** + * Parse the project from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).project; + } + + /** + * Parse the location from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).location; + } + + /** + * Parse the accelerator_type from AcceleratorType resource. + * + * @param {string} acceleratorTypeName + * A fully-qualified path representing AcceleratorType resource. + * @returns {string} A string representing the accelerator_type. + */ + matchAcceleratorTypeFromAcceleratorTypeName(acceleratorTypeName: string) { + return this.pathTemplates.acceleratorTypePathTemplate.match( + acceleratorTypeName + ).accelerator_type; + } + + /** + * 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 node resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} node + * @returns {string} Resource name string. + */ + nodePath(project: string, location: string, node: string) { + return this.pathTemplates.nodePathTemplate.render({ + project: project, + location: location, + node: node, + }); + } + + /** + * Parse the project from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).project; + } + + /** + * Parse the location from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the location. + */ + matchLocationFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).location; + } + + /** + * Parse the node from Node resource. + * + * @param {string} nodeName + * A fully-qualified path representing Node resource. + * @returns {string} A string representing the node. + */ + matchNodeFromNodeName(nodeName: string) { + return this.pathTemplates.nodePathTemplate.match(nodeName).node; + } + + /** + * 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 runtimeVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} runtime_version + * @returns {string} Resource name string. + */ + runtimeVersionPath( + project: string, + location: string, + runtimeVersion: string + ) { + return this.pathTemplates.runtimeVersionPathTemplate.render({ + project: project, + location: location, + runtime_version: runtimeVersion, + }); + } + + /** + * Parse the project from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).project; + } + + /** + * Parse the location from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).location; + } + + /** + * Parse the runtime_version from RuntimeVersion resource. + * + * @param {string} runtimeVersionName + * A fully-qualified path representing RuntimeVersion resource. + * @returns {string} A string representing the runtime_version. + */ + matchRuntimeVersionFromRuntimeVersionName(runtimeVersionName: string) { + return this.pathTemplates.runtimeVersionPathTemplate.match( + runtimeVersionName + ).runtime_version; + } + + /** + * 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.tpuStub && !this._terminated) { + return this.tpuStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json b/packages/google-cloud-tpu/src/v2/tpu_client_config.json similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_client_config.json rename to packages/google-cloud-tpu/src/v2/tpu_client_config.json diff --git a/owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json b/packages/google-cloud-tpu/src/v2/tpu_proto_list.json similarity index 100% rename from owl-bot-staging/google-cloud-tpu/v2/src/v2/tpu_proto_list.json rename to packages/google-cloud-tpu/src/v2/tpu_proto_list.json diff --git a/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json index d4f743c1646..521ba0b7c56 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json +++ b/packages/google-cloud-tpu/src/v2alpha1/gapic_metadata.json @@ -15,6 +15,11 @@ "getNode" ] }, + "GetQueuedResource": { + "methods": [ + "getQueuedResource" + ] + }, "GenerateServiceIdentity": { "methods": [ "generateServiceIdentity" @@ -60,6 +65,21 @@ "updateNode" ] }, + "CreateQueuedResource": { + "methods": [ + "createQueuedResource" + ] + }, + "DeleteQueuedResource": { + "methods": [ + "deleteQueuedResource" + ] + }, + "SimulateMaintenanceEvent": { + "methods": [ + "simulateMaintenanceEvent" + ] + }, "ListNodes": { "methods": [ "listNodes", @@ -67,6 +87,13 @@ "listNodesAsync" ] }, + "ListQueuedResources": { + "methods": [ + "listQueuedResources", + "listQueuedResourcesStream", + "listQueuedResourcesAsync" + ] + }, "ListAcceleratorTypes": { "methods": [ "listAcceleratorTypes", @@ -91,6 +118,11 @@ "getNode" ] }, + "GetQueuedResource": { + "methods": [ + "getQueuedResource" + ] + }, "GenerateServiceIdentity": { "methods": [ "generateServiceIdentity" @@ -136,6 +168,21 @@ "updateNode" ] }, + "CreateQueuedResource": { + "methods": [ + "createQueuedResource" + ] + }, + "DeleteQueuedResource": { + "methods": [ + "deleteQueuedResource" + ] + }, + "SimulateMaintenanceEvent": { + "methods": [ + "simulateMaintenanceEvent" + ] + }, "ListNodes": { "methods": [ "listNodes", @@ -143,6 +190,13 @@ "listNodesAsync" ] }, + "ListQueuedResources": { + "methods": [ + "listQueuedResources", + "listQueuedResourcesStream", + "listQueuedResourcesAsync" + ] + }, "ListAcceleratorTypes": { "methods": [ "listAcceleratorTypes", diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts index 9c02d2295a3..a085faabcf0 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client.ts @@ -27,6 +27,8 @@ import type { LROperation, PaginationCallback, GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; import {Transform} from 'stream'; import * as protos from '../../protos/protos'; @@ -63,6 +65,7 @@ export class TpuClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; tpuStub?: Promise<{[name: string]: Function}>; @@ -125,6 +128,9 @@ export class TpuClient { (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; @@ -157,6 +163,10 @@ export class TpuClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; @@ -189,6 +199,12 @@ export class TpuClient { nodePathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/nodes/{node}' ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + queuedResourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/queuedResources/{queued_resource}' + ), runtimeVersionPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}' ), @@ -203,6 +219,11 @@ export class TpuClient { 'nextPageToken', 'nodes' ), + listQueuedResources: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'queuedResources' + ), listAcceleratorTypes: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', @@ -232,6 +253,7 @@ export class TpuClient { additional_bindings: [ {get: '/v1/{name=projects/*/locations/*}'}, {get: '/v2alpha1/{name=projects/*/locations/*}'}, + {get: '/v2/{name=projects/*/locations/*}'}, ], }, { @@ -240,6 +262,7 @@ export class TpuClient { additional_bindings: [ {get: '/v1/{name=projects/*}/locations'}, {get: '/v2alpha1/{name=projects/*}/locations'}, + {get: '/v2/{name=projects/*}/locations'}, ], }, { @@ -250,6 +273,7 @@ export class TpuClient { { post: '/v2alpha1/{name=projects/*/locations/*/operations/*}:cancel', }, + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, ], }, { @@ -258,6 +282,7 @@ export class TpuClient { additional_bindings: [ {delete: '/v1/{name=projects/*/locations/*/operations/*}'}, {delete: '/v2alpha1/{name=projects/*/locations/*/operations/*}'}, + {delete: '/v2/{name=projects/*/locations/*/operations/*}'}, ], }, { @@ -266,6 +291,7 @@ export class TpuClient { additional_bindings: [ {get: '/v1/{name=projects/*/locations/*/operations/*}'}, {get: '/v2alpha1/{name=projects/*/locations/*/operations/*}'}, + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, ], }, { @@ -274,6 +300,7 @@ export class TpuClient { additional_bindings: [ {get: '/v1/{name=projects/*/locations/*}/operations'}, {get: '/v2alpha1/{name=projects/*/locations/*}/operations'}, + {get: '/v2/{name=projects/*/locations/*}/operations'}, ], }, ]; @@ -288,7 +315,7 @@ export class TpuClient { '.google.cloud.tpu.v2alpha1.OperationMetadata' ) as gax.protobuf.Type; const deleteNodeResponse = protoFilesRoot.lookup( - '.google.cloud.tpu.v2alpha1.Node' + '.google.protobuf.Empty' ) as gax.protobuf.Type; const deleteNodeMetadata = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.OperationMetadata' @@ -311,6 +338,24 @@ export class TpuClient { const updateNodeMetadata = protoFilesRoot.lookup( '.google.cloud.tpu.v2alpha1.OperationMetadata' ) as gax.protobuf.Type; + const createQueuedResourceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.QueuedResource' + ) as gax.protobuf.Type; + const createQueuedResourceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteQueuedResourceResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.QueuedResource' + ) as gax.protobuf.Type; + const deleteQueuedResourceMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; + const simulateMaintenanceEventResponse = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.Node' + ) as gax.protobuf.Type; + const simulateMaintenanceEventMetadata = protoFilesRoot.lookup( + '.google.cloud.tpu.v2alpha1.OperationMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createNode: new this._gaxModule.LongrunningDescriptor( @@ -338,6 +383,25 @@ export class TpuClient { updateNodeResponse.decode.bind(updateNodeResponse), updateNodeMetadata.decode.bind(updateNodeMetadata) ), + createQueuedResource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createQueuedResourceResponse.decode.bind(createQueuedResourceResponse), + createQueuedResourceMetadata.decode.bind(createQueuedResourceMetadata) + ), + deleteQueuedResource: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteQueuedResourceResponse.decode.bind(deleteQueuedResourceResponse), + deleteQueuedResourceMetadata.decode.bind(deleteQueuedResourceMetadata) + ), + simulateMaintenanceEvent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + simulateMaintenanceEventResponse.decode.bind( + simulateMaintenanceEventResponse + ), + simulateMaintenanceEventMetadata.decode.bind( + simulateMaintenanceEventMetadata + ) + ), }; // Put together the default options sent with requests. @@ -397,12 +461,17 @@ export class TpuClient { 'stopNode', 'startNode', 'updateNode', + 'listQueuedResources', + 'getQueuedResource', + 'createQueuedResource', + 'deleteQueuedResource', 'generateServiceIdentity', 'listAcceleratorTypes', 'getAcceleratorType', 'listRuntimeVersions', 'getRuntimeVersion', 'getGuestAttributes', + 'simulateMaintenanceEvent', ]; for (const methodName of tpuStubMethods) { const callPromise = this.tpuStub.then( @@ -572,6 +641,97 @@ export class TpuClient { this.initialize(); return this.innerApiCalls.getNode(request, options, callback); } + /** + * Gets details of a queued resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. + * 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/v2alpha1/tpu.get_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_GetQueuedResource_async + */ + getQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest | undefined, + {} | undefined + ] + >; + getQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + | protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + callback: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + | protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + | protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + | protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IGetQueuedResourceRequest | 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.getQueuedResource(request, options, callback); + } /** * Generates the Cloud TPU service identity for the project. * @@ -963,6 +1123,8 @@ export class TpuClient { * The unqualified resource name. * @param {google.cloud.tpu.v2alpha1.Node} request.node * Required. The node. + * @param {string} request.requestId + * Idempotent request UUID. * @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. @@ -1101,6 +1263,8 @@ export class TpuClient { * The request object that will be sent. * @param {string} request.name * Required. The resource name. + * @param {string} request.requestId + * Idempotent request UUID. * @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. @@ -1119,7 +1283,7 @@ export class TpuClient { ): Promise< [ LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, @@ -1131,7 +1295,7 @@ export class TpuClient { options: CallOptions, callback: Callback< LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, @@ -1142,7 +1306,7 @@ export class TpuClient { request: protos.google.cloud.tpu.v2alpha1.IDeleteNodeRequest, callback: Callback< LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, @@ -1155,7 +1319,7 @@ export class TpuClient { | CallOptions | Callback< LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, @@ -1163,7 +1327,7 @@ export class TpuClient { >, callback?: Callback< LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, @@ -1172,7 +1336,7 @@ export class TpuClient { ): Promise< [ LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, @@ -1213,7 +1377,7 @@ export class TpuClient { name: string ): Promise< LROperation< - protos.google.cloud.tpu.v2alpha1.Node, + protos.google.protobuf.Empty, protos.google.cloud.tpu.v2alpha1.OperationMetadata > > { @@ -1228,7 +1392,7 @@ export class TpuClient { this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< - protos.google.cloud.tpu.v2alpha1.Node, + protos.google.protobuf.Empty, protos.google.cloud.tpu.v2alpha1.OperationMetadata >; } @@ -1238,7 +1402,7 @@ export class TpuClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * The resource name. + * Required. The resource name. * @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. @@ -1376,7 +1540,7 @@ export class TpuClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * The resource name. + * Required. The resource name. * @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. @@ -1515,7 +1679,8 @@ export class TpuClient { * The request object that will be sent. * @param {google.protobuf.FieldMask} request.updateMask * Required. Mask of fields from {@link Tpu.Node|Node} to update. - * Supported fields: None. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. * @param {google.cloud.tpu.v2alpha1.Node} request.node * Required. The node. Only fields specified in update_mask are updated. * @param {object} [options] @@ -1650,77 +1815,95 @@ export class TpuClient { >; } /** - * Lists nodes. + * Creates a QueuedResource TPU instance. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The parent resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. + * @param {string} request.queuedResourceId + * The unqualified resource name. Should follow the ^[A-Za-z0-9_.~+%-]+$ + * regex format. + * @param {google.cloud.tpu.v2alpha1.QueuedResource} request.queuedResource + * Required. The queued resource. + * @param {string} request.requestId + * Idempotent request UUID. * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. - * 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 `listNodesAsync()` - * method described below for async iteration which you can stop as needed. + * 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#auto-pagination) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.create_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async */ - listNodes( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + createQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.tpu.v2alpha1.INode[], - protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined ] >; - listNodes( - request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + createQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, - protos.google.cloud.tpu.v2alpha1.INode + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): void; - listNodes( - request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - callback: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, - protos.google.cloud.tpu.v2alpha1.INode + createQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): void; - listNodes( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + createQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.ICreateQueuedResourceRequest, optionsOrCallback?: | CallOptions - | PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - | protos.google.cloud.tpu.v2alpha1.IListNodesResponse - | null - | undefined, - protos.google.cloud.tpu.v2alpha1.INode + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined >, - callback?: PaginationCallback< - protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, - protos.google.cloud.tpu.v2alpha1.INode + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): Promise< [ - protos.google.cloud.tpu.v2alpha1.INode[], - protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, - protos.google.cloud.tpu.v2alpha1.IListNodesResponse + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined ] > | void { request = request || {}; @@ -1739,82 +1922,685 @@ export class TpuClient { parent: request.parent ?? '', }); this.initialize(); - return this.innerApiCalls.listNodes(request, options, callback); + return this.innerApiCalls.createQueuedResource(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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. - * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node} 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 `listNodesAsync()` - * method described below for async iteration which you can stop as needed. + * Check the status of the long running operation returned by `createQueuedResource()`. + * @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#auto-pagination) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. + * @example include:samples/generated/v2alpha1/tpu.create_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_CreateQueuedResource_async */ - listNodesStream( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, - 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['listNodes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNodes.createStream( - this.innerApiCalls.listNodes as GaxCall, - request, - callSettings + async checkCreateQueuedResourceProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + 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.createQueuedResource, + this._gaxModule.createDefaultBackoffSettings() ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; } - /** - * Equivalent to `listNodes`, but returns an iterable object. + * Deletes a QueuedResource TPU instance. * - * `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 resource name. - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, if any. + * @param {string} request.name + * Required. The resource name. + * @param {string} request.requestId + * Idempotent request UUID. * @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). + * @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/v2alpha1/tpu.delete_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async + */ + deleteQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteQueuedResource( + request: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteQueuedResource( + request?: protos.google.cloud.tpu.v2alpha1.IDeleteQueuedResourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + 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.deleteQueuedResource(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteQueuedResource()`. + * @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/v2alpha1/tpu.delete_queued_resource.js + * region_tag:tpu_v2alpha1_generated_Tpu_DeleteQueuedResource_async + */ + async checkDeleteQueuedResourceProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + 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.deleteQueuedResource, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.QueuedResource, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + /** + * Simulates a maintenance event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name. + * @param {string[]} request.workerIds + * The 0-based worker ID. If it is empty, worker ID 0 will be selected for + * maintenance event simulation. A maintenance event will only be fired on the + * first specified worker ID. Future implementations may support firing on + * multiple workers. + * @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/v2alpha1/tpu.simulate_maintenance_event.js + * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async + */ + simulateMaintenanceEvent( + request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + simulateMaintenanceEvent( + request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + simulateMaintenanceEvent( + request: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + callback: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + simulateMaintenanceEvent( + request?: protos.google.cloud.tpu.v2alpha1.ISimulateMaintenanceEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >, + 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.simulateMaintenanceEvent( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `simulateMaintenanceEvent()`. + * @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/v2alpha1/tpu.simulate_maintenance_event.js + * region_tag:tpu_v2alpha1_generated_Tpu_SimulateMaintenanceEvent_async + */ + async checkSimulateMaintenanceEventProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + > + > { + 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.simulateMaintenanceEvent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.tpu.v2alpha1.Node, + protos.google.cloud.tpu.v2alpha1.OperationMetadata + >; + } + /** + * Lists nodes. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node}. + * 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 `listNodesAsync()` + * 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. + */ + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ] + >; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): void; + listNodes( + request: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): void; + listNodes( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + | protos.google.cloud.tpu.v2alpha1.IListNodesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.INode + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse | null | undefined, + protos.google.cloud.tpu.v2alpha1.INode + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.INode[], + protos.google.cloud.tpu.v2alpha1.IListNodesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListNodesResponse + ] + > | 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.listNodes(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [Node]{@link google.cloud.tpu.v2alpha1.Node} 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 `listNodesAsync()` + * 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. + */ + listNodesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.createStream( + this.innerApiCalls.listNodes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listNodes`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 + * [Node]{@link google.cloud.tpu.v2alpha1.Node}. 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/v2alpha1/tpu.list_nodes.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListNodes_async + */ + listNodesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + 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['listNodes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNodes.asyncIterate( + this.innerApiCalls['listNodes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists queued resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. + * 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 `listQueuedResourcesAsync()` + * 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. + */ + listQueuedResources( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IQueuedResource[], + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + ] + >; + listQueuedResources( + request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + | protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource + > + ): void; + listQueuedResources( + request: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + | protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource + > + ): void; + listQueuedResources( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + | protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource + >, + callback?: PaginationCallback< + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + | protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + | null + | undefined, + protos.google.cloud.tpu.v2alpha1.IQueuedResource + > + ): Promise< + [ + protos.google.cloud.tpu.v2alpha1.IQueuedResource[], + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest | null, + protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesResponse + ] + > | 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.listQueuedResources(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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource} 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 `listQueuedResourcesAsync()` + * 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. + */ + listQueuedResourcesStream( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, + 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['listQueuedResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQueuedResources.createStream( + this.innerApiCalls.listQueuedResources as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listQueuedResources`, 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 resource name. + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The next_page_token value returned from a previous List request, if any. + * @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 - * [Node]{@link google.cloud.tpu.v2alpha1.Node}. The API will be called under the hood as needed, once per the page, + * [QueuedResource]{@link google.cloud.tpu.v2alpha1.QueuedResource}. 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/v2alpha1/tpu.list_nodes.js - * region_tag:tpu_v2alpha1_generated_Tpu_ListNodes_async + * @example include:samples/generated/v2alpha1/tpu.list_queued_resources.js + * region_tag:tpu_v2alpha1_generated_Tpu_ListQueuedResources_async */ - listNodesAsync( - request?: protos.google.cloud.tpu.v2alpha1.IListNodesRequest, + listQueuedResourcesAsync( + request?: protos.google.cloud.tpu.v2alpha1.IListQueuedResourcesRequest, options?: CallOptions - ): AsyncIterable { + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1823,14 +2609,14 @@ export class TpuClient { this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); - const defaultCallSettings = this._defaults['listNodes']; + const defaultCallSettings = this._defaults['listQueuedResources']; const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.descriptors.page.listNodes.asyncIterate( - this.innerApiCalls['listNodes'] as GaxCall, + return this.descriptors.page.listQueuedResources.asyncIterate( + this.innerApiCalls['listQueuedResources'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** * Lists accelerator types supported by this API. @@ -2234,6 +3020,263 @@ export class TpuClient { callSettings ) as AsyncIterable; } + /** + * 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 [Location]{@link google.cloud.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 + * [Location]{@link google.cloud.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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 -- // -------------------- @@ -2382,6 +3425,88 @@ export class TpuClient { return this.pathTemplates.nodePathTemplate.match(nodeName).node; } + /** + * 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 queuedResource resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} queued_resource + * @returns {string} Resource name string. + */ + queuedResourcePath( + project: string, + location: string, + queuedResource: string + ) { + return this.pathTemplates.queuedResourcePathTemplate.render({ + project: project, + location: location, + queued_resource: queuedResource, + }); + } + + /** + * Parse the project from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the project. + */ + matchProjectFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match( + queuedResourceName + ).project; + } + + /** + * Parse the location from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the location. + */ + matchLocationFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match( + queuedResourceName + ).location; + } + + /** + * Parse the queued_resource from QueuedResource resource. + * + * @param {string} queuedResourceName + * A fully-qualified path representing QueuedResource resource. + * @returns {string} A string representing the queued_resource. + */ + matchQueuedResourceFromQueuedResourceName(queuedResourceName: string) { + return this.pathTemplates.queuedResourcePathTemplate.match( + queuedResourceName + ).queued_resource; + } + /** * Return a fully-qualified runtimeVersion resource name string. * @@ -2452,6 +3577,7 @@ export class TpuClient { return this.tpuStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json index d268f63d19d..5adc5503d1e 100644 --- a/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json +++ b/packages/google-cloud-tpu/src/v2alpha1/tpu_client_config.json @@ -55,6 +55,26 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ListQueuedResources": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteQueuedResource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GenerateServiceIdentity": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", @@ -84,6 +104,11 @@ "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "SimulateMaintenanceEvent": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v2.ts b/packages/google-cloud-tpu/test/gapic_tpu_v2.ts new file mode 100644 index 00000000000..d8a2d6c00b9 --- /dev/null +++ b/packages/google-cloud-tpu/test/gapic_tpu_v2.ts @@ -0,0 +1,3558 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as tpuModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + 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.TpuClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = tpuModule.v2.TpuClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = tpuModule.v2.TpuClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = tpuModule.v2.TpuClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new tpuModule.v2.TpuClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new tpuModule.v2.TpuClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + await client.initialize(); + assert(client.tpuStub); + }); + + it('has close method for the initialized client', done => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.tpuStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.tpuStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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('getNode', () => { + it('invokes getNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.Node() + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.Node() + ); + client.innerApiCalls.getNode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.INode | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getNode with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNode(request), expectedError); + }); + }); + + describe('generateServiceIdentity', () => { + it('invokes generateServiceIdentity without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GenerateServiceIdentityRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = + stubSimpleCall(expectedResponse); + const [response] = await client.generateServiceIdentity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GenerateServiceIdentityRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityResponse() + ); + client.innerApiCalls.generateServiceIdentity = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateServiceIdentity( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IGenerateServiceIdentityResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GenerateServiceIdentityRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateServiceIdentity = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.generateServiceIdentity(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateServiceIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateServiceIdentity with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GenerateServiceIdentityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GenerateServiceIdentityRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.generateServiceIdentity(request), + expectedError + ); + }); + }); + + describe('getAcceleratorType', () => { + it('invokes getAcceleratorType without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetAcceleratorTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = + stubSimpleCall(expectedResponse); + const [response] = await client.getAcceleratorType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetAcceleratorTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.AcceleratorType() + ); + client.innerApiCalls.getAcceleratorType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAcceleratorType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IAcceleratorType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetAcceleratorTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAcceleratorType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAcceleratorType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAcceleratorType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAcceleratorType with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetAcceleratorTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetAcceleratorTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAcceleratorType(request), expectedError); + }); + }); + + describe('getRuntimeVersion', () => { + it('invokes getRuntimeVersion without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetRuntimeVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getRuntimeVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetRuntimeVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.RuntimeVersion() + ); + client.innerApiCalls.getRuntimeVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRuntimeVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IRuntimeVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetRuntimeVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRuntimeVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getRuntimeVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRuntimeVersion with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetRuntimeVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetRuntimeVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRuntimeVersion(request), expectedError); + }); + }); + + describe('getGuestAttributes', () => { + it('invokes getGuestAttributes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetGuestAttributesRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = + stubSimpleCall(expectedResponse); + const [response] = await client.getGuestAttributes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetGuestAttributesRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesResponse() + ); + client.innerApiCalls.getGuestAttributes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGuestAttributes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IGetGuestAttributesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetGuestAttributesRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGuestAttributes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getGuestAttributes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGuestAttributes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGuestAttributes with closed client', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.GetGuestAttributesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.GetGuestAttributesRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGuestAttributes(request), expectedError); + }); + }); + + describe('createNode', () => { + it('invokes createNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.CreateNodeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.createNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.CreateNodeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.CreateNodeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createNode(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.CreateNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.CreateNodeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkCreateNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkCreateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteNode', () => { + it('invokes deleteNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.DeleteNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.DeleteNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.tpu.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.DeleteNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteNode(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.DeleteNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.DeleteNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkDeleteNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkDeleteNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('stopNode', () => { + it('invokes stopNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StopNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.stopNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StopNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.stopNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StopNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.stopNode(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StopNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StopNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.stopNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStopNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStopNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStopNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStopNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('startNode', () => { + it('invokes startNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StartNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.startNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StartNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.startNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StartNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.startNode(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.StartNodeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.StartNodeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.startNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkStartNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStartNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkStartNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkStartNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateNode', () => { + it('invokes updateNode without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.UpdateNodeRequest', + ['node', 'name'] + ); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNode(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.UpdateNodeRequest', + ['node', 'name'] + ); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateNode = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNode( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2.INode, + protos.google.cloud.tpu.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with call error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.UpdateNodeRequest', + ['node', 'name'] + ); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateNode(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateNode with LRO error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.UpdateNodeRequest() + ); + request.node ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.UpdateNodeRequest', + ['node', 'name'] + ); + request.node.name = defaultValue1; + const expectedHeaderRequestParams = `node.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNode = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateNode(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateNodeProgress without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkUpdateNodeProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateNodeProgress with error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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.checkUpdateNodeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.innerApiCalls.listNodes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.INode[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.descriptors.page.listNodes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IAcceleratorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.AcceleratorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2.AcceleratorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + generateSampleMessage(new protos.google.cloud.tpu.v2.AcceleratorType()), + ]; + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.IAcceleratorType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimeVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions without error using callback', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.innerApiCalls.listRuntimeVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimeVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2.IRuntimeVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersions with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimeVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimeVersions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimeVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRuntimeVersionsStream without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { + 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.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRuntimeVersionsStream with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2.RuntimeVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2.RuntimeVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions without error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + generateSampleMessage(new protos.google.cloud.tpu.v2.RuntimeVersion()), + ]; + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions with error', async () => { + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRuntimeVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2.IRuntimeVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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 tpuModule.v2.TpuClient({ + 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('acceleratorType', () => { + const fakePath = '/rendered/path/acceleratorType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + accelerator_type: 'acceleratorTypeValue', + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.acceleratorTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.acceleratorTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('acceleratorTypePath', () => { + const result = client.acceleratorTypePath( + 'projectValue', + 'locationValue', + 'acceleratorTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAcceleratorTypeName', () => { + const result = client.matchProjectFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAcceleratorTypeName', () => { + const result = client.matchLocationFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAcceleratorTypeFromAcceleratorTypeName', () => { + const result = + client.matchAcceleratorTypeFromAcceleratorTypeName(fakePath); + assert.strictEqual(result, 'acceleratorTypeValue'); + assert( + (client.pathTemplates.acceleratorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new tpuModule.v2.TpuClient({ + 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('node', () => { + const fakePath = '/rendered/path/node'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + node: 'nodeValue', + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.nodePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.nodePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath( + 'projectValue', + 'locationValue', + 'nodeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, 'nodeValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new tpuModule.v2.TpuClient({ + 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('runtimeVersion', () => { + const fakePath = '/rendered/path/runtimeVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + runtime_version: 'runtimeVersionValue', + }; + const client = new tpuModule.v2.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.runtimeVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.runtimeVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('runtimeVersionPath', () => { + const result = client.runtimeVersionPath( + 'projectValue', + 'locationValue', + 'runtimeVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRuntimeVersionName', () => { + const result = client.matchProjectFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRuntimeVersionName', () => { + const result = client.matchLocationFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRuntimeVersionFromRuntimeVersionName', () => { + const result = + client.matchRuntimeVersionFromRuntimeVersionName(fakePath); + assert.strictEqual(result, 'runtimeVersionValue'); + assert( + (client.pathTemplates.runtimeVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts index 31decf43dc0..e80111f2cb4 100644 --- a/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts +++ b/packages/google-cloud-tpu/test/gapic_tpu_v2alpha1.ts @@ -25,7 +25,12 @@ import * as tpuModule from '../src'; import {PassThrough} from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -384,6 +389,136 @@ describe('v2alpha1.TpuClient', () => { }); }); + describe('getQueuedResource', () => { + it('invokes getQueuedResource without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ); + client.innerApiCalls.getQueuedResource = stubSimpleCall(expectedResponse); + const [response] = await client.getQueuedResource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ); + client.innerApiCalls.getQueuedResource = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getQueuedResource( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getQueuedResource = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getQueuedResource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQueuedResource with closed client', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.GetQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getQueuedResource(request), expectedError); + }); + }); + describe('generateServiceIdentity', () => { it('invokes generateServiceIdentity without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ @@ -1162,7 +1297,7 @@ describe('v2alpha1.TpuClient', () => { ( err?: Error | null, result?: LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata > | null ) => { @@ -1175,7 +1310,7 @@ describe('v2alpha1.TpuClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.tpu.v2alpha1.INode, + protos.google.protobuf.IEmpty, protos.google.cloud.tpu.v2alpha1.IOperationMetadata >; const [response] = await operation.promise(); @@ -1867,68 +2002,69 @@ describe('v2alpha1.TpuClient', () => { }); }); - describe('listNodes', () => { - it('invokes listNodes without error', async () => { + describe('createQueuedResource', () => { + it('invokes createQueuedResource without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createQueuedResource = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createQueuedResource(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listNodes without error using callback', async () => { + it('invokes createQueuedResource without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.innerApiCalls.listNodes = - stubSimpleCallWithCallback(expectedResponse); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createQueuedResource = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listNodes( + client.createQueuedResource( request, ( err?: Error | null, - result?: protos.google.cloud.tpu.v2alpha1.INode[] | null + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null ) => { if (err) { reject(err); @@ -1938,180 +2074,1421 @@ describe('v2alpha1.TpuClient', () => { } ); }); - const response = await promise; + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listNodes with error', async () => { + it('invokes createQueuedResource with call error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodes(request), expectedError); + client.innerApiCalls.createQueuedResource = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createQueuedResource(request), expectedError); const actualRequest = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listNodes as SinonStub + client.innerApiCalls.createQueuedResource as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listNodesStream without error', async () => { + it('invokes createQueuedResource with LRO error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.CreateQueuedResourceRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - ]; - client.descriptors.page.listNodes.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { - 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.listNodes.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listNodes, request) - ); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + const expectedError = new Error('expected'); + client.innerApiCalls.createQueuedResource = stubLongRunningCall( + undefined, + undefined, + expectedError ); + const [operation] = await client.createQueuedResource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listNodesStream with error', async () => { + it('invokes checkCreateQueuedResourceProgress without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; - stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listNodes, request) + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() ); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + 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.checkCreateQueuedResourceProgress( + expectedResponse.name ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('uses async iteration with listNodes without error', async () => { + it('invokes checkCreateQueuedResourceProgress with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateQueuedResourceProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteQueuedResource', () => { + it('invokes deleteQueuedResource without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteQueuedResource = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteQueuedResource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteQueuedResource = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteQueuedResource( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.IQueuedResource, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteQueuedResource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteQueuedResource with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.DeleteQueuedResourceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteQueuedResource = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteQueuedResource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteQueuedResource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteQueuedResourceProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteQueuedResourceProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteQueuedResourceProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkDeleteQueuedResourceProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('simulateMaintenanceEvent', () => { + it('invokes simulateMaintenanceEvent without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = + stubLongRunningCall(expectedResponse); + const [operation] = await client.simulateMaintenanceEvent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.simulateMaintenanceEvent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.simulateMaintenanceEvent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.tpu.v2alpha1.INode, + protos.google.cloud.tpu.v2alpha1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with call error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.simulateMaintenanceEvent(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes simulateMaintenanceEvent with LRO error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.SimulateMaintenanceEventRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.simulateMaintenanceEvent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.simulateMaintenanceEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.simulateMaintenanceEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSimulateMaintenanceEventProgress without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkSimulateMaintenanceEventProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSimulateMaintenanceEventProgress with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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.checkSimulateMaintenanceEventProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.innerApiCalls.listNodes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.INode[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listNodesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + 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.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listNodesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.Node[] = []; + stream.on('data', (response: protos.google.cloud.tpu.v2alpha1.Node) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request) + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listNodes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListNodesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listQueuedResources', () => { + it('invokes listQueuedResources without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + ]; + client.innerApiCalls.listQueuedResources = + stubSimpleCall(expectedResponse); + const [response] = await client.listQueuedResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResources without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + ]; + client.innerApiCalls.listQueuedResources = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listQueuedResources( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResources with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listQueuedResources = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listQueuedResources(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQueuedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQueuedResourcesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + ]; + client.descriptors.page.listQueuedResources.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listQueuedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { + 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.listQueuedResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQueuedResources, request) + ); + assert( + (client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listQueuedResourcesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQueuedResources.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listQueuedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.QueuedResource[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.QueuedResource) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQueuedResources, request) + ); + assert( + (client.descriptors.page.listQueuedResources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listQueuedResources without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.QueuedResource() + ), + ]; + client.descriptors.page.listQueuedResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = []; + const iterable = client.listQueuedResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listQueuedResources.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listQueuedResources with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListQueuedResourcesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQueuedResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listQueuedResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IQueuedResource[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listQueuedResources.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQueuedResources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listAcceleratorTypes', () => { + it('invokes listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), - generateSampleMessage(new protos.google.cloud.tpu.v2alpha1.Node()), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listAcceleratorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.innerApiCalls.listAcceleratorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAcceleratorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypes with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAcceleratorTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAcceleratorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAcceleratorTypesStream without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + ]; + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + 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.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAcceleratorTypesStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAcceleratorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAcceleratorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + ); + assert( + (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAcceleratorTypes without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + ), ]; - client.descriptors.page.listNodes.asyncIterate = + client.descriptors.page.listAcceleratorTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; - const iterable = client.listNodesAsync(request); + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; + const iterable = client.listAcceleratorTypesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) - .args[1], + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -2119,40 +3496,40 @@ describe('v2alpha1.TpuClient', () => { ); }); - it('uses async iteration with listNodes with error', async () => { + it('uses async iteration with listAcceleratorTypes with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListNodesRequest() + new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListNodesRequest', + '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listNodesAsync(request); + client.descriptors.page.listAcceleratorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAcceleratorTypesAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.INode[] = []; + const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) - .args[1], + ( + client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) + (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -2161,81 +3538,81 @@ describe('v2alpha1.TpuClient', () => { }); }); - describe('listAcceleratorTypes', () => { - it('invokes listAcceleratorTypes without error', async () => { + describe('listRuntimeVersions', () => { + it('invokes listRuntimeVersions without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.innerApiCalls.listAcceleratorTypes = + client.innerApiCalls.listRuntimeVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listAcceleratorTypes(request); + const [response] = await client.listRuntimeVersions(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypes without error using callback', async () => { + it('invokes listRuntimeVersions without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.innerApiCalls.listAcceleratorTypes = + client.innerApiCalls.listRuntimeVersions = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listAcceleratorTypes( + client.listRuntimeVersions( request, ( err?: Error | null, - result?: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] | null + result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] | null ) => { if (err) { reject(err); @@ -2248,81 +3625,130 @@ describe('v2alpha1.TpuClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypes with error', async () => { + it('invokes listRuntimeVersions with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listAcceleratorTypes = stubSimpleCall( + client.innerApiCalls.listRuntimeVersions = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listAcceleratorTypes(request), expectedError); + await assert.rejects(client.listRuntimeVersions(request), expectedError); const actualRequest = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listAcceleratorTypes as SinonStub + client.innerApiCalls.listRuntimeVersions as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listAcceleratorTypesStream without error', async () => { + it('invokes listRuntimeVersionsStream without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() ), ]; - client.descriptors.page.listAcceleratorTypes.createStream = + client.descriptors.page.listRuntimeVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAcceleratorTypesStream(request); + const stream = client.listRuntimeVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = - []; + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; stream.on( 'data', - (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { + 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.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRuntimeVersionsStream with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRuntimeVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { responses.push(response); } ); @@ -2333,155 +3759,302 @@ describe('v2alpha1.TpuClient', () => { reject(err); }); }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listRuntimeVersions, request) + ); + assert( + (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions without error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + ), + ]; + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; + const iterable = client.listRuntimeVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRuntimeVersions with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRuntimeVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRuntimeVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request ); assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - - it('invokes listAcceleratorTypesStream with error', async () => { + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() + 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() ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', - ['parent'] + 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) ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listAcceleratorTypesStream(request); + }); + it('invokes getLocation without error using callback', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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) => { - const responses: protos.google.cloud.tpu.v2alpha1.AcceleratorType[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.tpu.v2alpha1.AcceleratorType) => { - responses.push(response); + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } } ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listAcceleratorTypes.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listAcceleratorTypes, request) + 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 tpuModule.v2alpha1.TpuClient({ + 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.descriptors.page.listAcceleratorTypes.createStream as SinonStub) + (client.locationsClient.getLocation as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .calledWith(request, expectedOptions, undefined) ); }); - - it('uses async iteration with listAcceleratorTypes without error', async () => { + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', - ['parent'] + new LocationProtos.google.cloud.location.ListLocationsRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new LocationProtos.google.cloud.location.Location() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new LocationProtos.google.cloud.location.Location() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.AcceleratorType() + new LocationProtos.google.cloud.location.Location() ), ]; - client.descriptors.page.listAcceleratorTypes.asyncIterate = + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = []; - const iterable = client.listAcceleratorTypesAsync(request); + 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.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + ( + 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 listAcceleratorTypes with error', async () => { + it('uses async iteration with listLocations with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListAcceleratorTypesRequest', - ['parent'] + new LocationProtos.google.cloud.location.ListLocationsRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedError = new Error('expected'); - client.descriptors.page.listAcceleratorTypes.asyncIterate = + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAcceleratorTypesAsync(request); + const iterable = client.listLocationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IAcceleratorType[] = - []; + const responses: LocationProtos.google.cloud.location.ILocation[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( ( - client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listAcceleratorTypes.asyncIterate as SinonStub) + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -2489,82 +4062,49 @@ describe('v2alpha1.TpuClient', () => { ); }); }); - - describe('listRuntimeVersions', () => { - it('invokes listRuntimeVersions without error', async () => { + describe('getOperation', () => { + it('invokes getOperation without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new operationsProtos.google.longrunning.GetOperationRequest() ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + 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) ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - ]; - client.innerApiCalls.listRuntimeVersions = - stubSimpleCall(expectedResponse); - const [response] = await client.listRuntimeVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - - it('invokes listRuntimeVersions without error using callback', async () => { + it('invokes getOperation without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new operationsProtos.google.longrunning.GetOperationRequest() ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - ]; - client.innerApiCalls.listRuntimeVersions = - stubSimpleCallWithCallback(expectedResponse); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); const promise = new Promise((resolve, reject) => { - client.listRuntimeVersions( + client.operationsClient.getOperation( request, + undefined, ( err?: Error | null, - result?: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] | null + result?: operationsProtos.google.longrunning.Operation | null ) => { if (err) { reject(err); @@ -2576,226 +4116,243 @@ describe('v2alpha1.TpuClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 tpuModule.v2alpha1.TpuClient({ + 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 listRuntimeVersions with error', async () => { + it('invokes cancelOperation with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + new operationsProtos.google.longrunning.CancelOperationRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listRuntimeVersions = stubSimpleCall( + client.operationsClient.cancelOperation = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.listRuntimeVersions(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listRuntimeVersions as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); }); - - it('invokes listRuntimeVersionsStream without error', async () => { + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + new operationsProtos.google.longrunning.DeleteOperationRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() - ), - ]; - client.descriptors.page.listRuntimeVersions.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listRuntimeVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; - stream.on( - 'data', - (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { - 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.listRuntimeVersions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listRuntimeVersions, request) + 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.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .calledWith(request) ); }); - - it('invokes listRuntimeVersionsStream with error', async () => { + it('invokes deleteOperation without error using callback', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() + new operationsProtos.google.longrunning.DeleteOperationRequest() ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listRuntimeVersionsStream(request); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tpu.v2alpha1.RuntimeVersion[] = []; - stream.on( - 'data', - (response: protos.google.cloud.tpu.v2alpha1.RuntimeVersion) => { - responses.push(response); + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } } ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listRuntimeVersions.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listRuntimeVersions, request) + 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 tpuModule.v2alpha1.TpuClient({ + 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.descriptors.page.listRuntimeVersions.createStream as SinonStub) + (client.operationsClient.deleteOperation as SinonStub) .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) + .calledWith(request) ); }); - - it('uses async iteration with listRuntimeVersions without error', async () => { + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + new operationsProtos.google.longrunning.ListOperationsRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new operationsProtos.google.longrunning.ListOperationsResponse() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new operationsProtos.google.longrunning.ListOperationsResponse() ), generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.RuntimeVersion() + new operationsProtos.google.longrunning.ListOperationsResponse() ), ]; - client.descriptors.page.listRuntimeVersions.asyncIterate = + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = []; - const iterable = client.listRuntimeVersionsAsync(request); + 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.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); - - it('uses async iteration with listRuntimeVersions with error', async () => { + it('uses async iteration with listOperations with error', async () => { const client = new tpuModule.v2alpha1.TpuClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.tpu.v2alpha1.ListRuntimeVersionsRequest', - ['parent'] + new operationsProtos.google.longrunning.ListOperationsRequest() ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listRuntimeVersions.asyncIterate = + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRuntimeVersionsAsync(request); + const iterable = client.operationsClient.listOperationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.tpu.v2alpha1.IRuntimeVersion[] = + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -2803,17 +4360,11 @@ describe('v2alpha1.TpuClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub ).getCall(0).args[1], request ); - assert( - (client.descriptors.page.listRuntimeVersions.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); }); @@ -2996,6 +4547,109 @@ describe('v2alpha1.TpuClient', () => { }); }); + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + 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('queuedResource', () => { + const fakePath = '/rendered/path/queuedResource'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + queued_resource: 'queuedResourceValue', + }; + const client = new tpuModule.v2alpha1.TpuClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.queuedResourcePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.queuedResourcePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('queuedResourcePath', () => { + const result = client.queuedResourcePath( + 'projectValue', + 'locationValue', + 'queuedResourceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.queuedResourcePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromQueuedResourceName', () => { + const result = client.matchProjectFromQueuedResourceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromQueuedResourceName', () => { + const result = client.matchLocationFromQueuedResourceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQueuedResourceFromQueuedResourceName', () => { + const result = + client.matchQueuedResourceFromQueuedResourceName(fakePath); + assert.strictEqual(result, 'queuedResourceValue'); + assert( + (client.pathTemplates.queuedResourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('runtimeVersion', () => { const fakePath = '/rendered/path/runtimeVersion'; const expectedParameters = {